Open yogithesymbian opened 3 weeks ago
When using the PageContainer component with the loading property:
PageContainer
loading
loading={{ spinning: loading, tip: 'Page loading...', }}
the content inside the PageContainer renders twice when running ( + R ) / navigation. without loading its run once only.
console log [mounted] HomePage [mounted] LayoutPage [mounted] HomePage
<PageContainer token={{ paddingInlinePageContainerContent: num, }} loading={{ spinning: loading, tip: 'Page loading...', }} > {props.children} // renders twice </PageContainer>
The content inside the PageContainer should render only once.
"use client"; import { Space } from "antd"; import { useEffect, useRef } from "react"; import YoAlert from "@/components/Feedback/YoAlert"; const HomePage: React.FC = () => { const isMounted = useRef(false); useEffect(() => { isMounted.current = true; return () => { isMounted.current = false; }; }, []); useEffect(() => { if (isMounted) { console.log("[mounted] HomePage"); } }, [isMounted]); return ( <> <Space direction="vertical" size={"middle"} style={{ display: "flex" }}> <YoAlert disabledMarquee={true} closable={true} message={ <>Welcome yogi arif widodo</> } type="success" /> </Space> </> ); }; export default HomePage;
Any relevant screenshots or additional information can be added here.
🐛 Bug Description
When using the
PageContainer
component with theloading
property:the content inside the
PageContainer
renders twice when running ( + R ) / navigation. without loading its run once only.📷 Recurrence Steps
PageContainer
component as shown below:PageContainer
renders twice.🏞 Expected Results
The content inside the
PageContainer
should render only once.💻 Recurrence Code
PageContainer Component Usage
Home Page Component
© Version Information
🚑 Other Information
Any relevant screenshots or additional information can be added here.