curi: [React] CSS not loading when using redirectTo

Version - @curi/router: 1.0.4

Disclaimer, I’m using SSR so I’m not sure if that’s related.

I’m trying to use redirectTo in my routes file by doing this

{
        name: 'CreateAccount',
        path: 'signup',
        resolve: {
            authorized: hasPlanSelected //this is a separate function returning a promise
        },
        response({ resolved }) {
            if (resolved.authorized) {
                return { body: CreateAccount };
            }

            return {
                redirectTo: { name: 'Pricing' },
                status: 302
            };
        }
    },

It’s working, but once I’m redirected to Pricing, the CSS is not loaded although I’m importing it at the top of the file. I took a look at @hickory/browser and found finalizeReplace (line 65), and I see that there’s a try/catch block using window.history.replaceState first. Would this have anything to do with CSS not loading for a new page?

It’s my hunch because when I manually use window.location.replace as the redirect tool, the CSS is normal.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 35 (15 by maintainers)

Most upvoted comments

You’re welcome! I’m working on putting together an SSR guide, so hopefully some of the setup will be more obvious.