0

I am trying to familiarize myself with NEXTJS 13.4 I have this app directory on a local project App dir Screenshot and I have this code on app/platform/layout.tsx

"use client";
import { CactusLayout, CactusSection } from "medzy/components/layouts/Cactus";
import { useSession } from "next-auth/react";
import { redirect } from "next/navigation";

export default function LayoutPlatform ({main,widgets}: {
    main: React.ReactNode;
    widgets: React.ReactNode;
  }) {
    
    const {status} = useSession()
    return (
       <CactusLayout>
        <CactusSection specify="w-1/12 xl:w-1/4" right border> <div>SIDEBAR</div> </CactusSection>
        {
              (status == "loading")         ? <div>LOADING CLIENT</div>
            : (status == "unauthenticated") ?  redirect("/auth")
            : (
                <>
                <CactusSection specify="flex-1">  {main}  </CactusSection>
                {widgets} 
                </>
            )
        }
        </CactusLayout>
        
    )
}

When I access localhost:3000/platform There is no loading state showing up for the two slots when I tried something simillar without the slots it worked fine I tried fetching mock data with a delay to make sure the use of loading.js but nothing shows until the pages are renders trace : I click on localhost:3000/platform some layout elements shows up : SIDEBAR and LOADING CLIENT and then the loading.js of app/loading.js shows up and then the rendered pages show up

I tried to update nextjs to latest I tried to look for configuration problems but I couldn't find the solution

  • Hi and welcome! Are you able to access a console with error messages? Some screenshots of what you are seeing might be helpful as well. You may also fine some tips in this article on [strategies for good questions on stack overflow](https://stackoverflow.com/help/how-to-ask) to get the most of your questions. – Michael Merchant May 23 '23 at 10:47
  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community May 23 '23 at 10:48
  • Did you find any solution to this? Currently having an issue with loading.tsx not working correctly inside production, it still spends ages fetching data on a blank webpage and then flashes the loading page once – Corcor Jun 23 '23 at 02:45
  • 1
    @Corcor Annoyingly, there's no fix for this at the moment. Lots of people are having this exact issue. There's a tonne of GitHub issues open about it. – James William Jun 23 '23 at 15:18

0 Answers0