Experiment delay render items in carousel

This commit is contained in:
Lim Chee Aun 2024-01-02 19:56:54 +08:00
parent 764125e6b9
commit b4d4c61128

View file

@ -714,6 +714,13 @@ function StatusCarousel({ title, class: className, children }) {
// init?.();
// }, []);
const [render, setRender] = useState(false);
useEffect(() => {
setTimeout(() => {
setRender(true);
}, 1);
}, []);
return (
<div class={`status-carousel ${className}`}>
<header>
@ -757,7 +764,8 @@ function StatusCarousel({ title, class: className, children }) {
startButtonRef.current.disabled = inView;
}}
/>
{children}
{children[0]}
{render && children.slice(1)}
<InView
class="status-carousel-beacon"
onChange={(inView) => {