Skip to content

[Bug]: Route link function not called (and CSS not loaded) when page loads after POST-ing to itself #1326

@revelt

Description

@revelt

Which Remix packages are impacted?

  • remix (Remix core)
  • create-remix
  • @remix-run/architect
  • @remix-run/cloudflare-workers
  • @remix-run/dev
  • @remix-run/express
  • @remix-run/netlify
  • @remix-run/node
  • @remix-run/react
  • @remix-run/serve
  • @remix-run/server-runtime
  • @remix-run/vercel

What version of Remix are you using?

1.1.1

What version of Node are you using? Minimum supported version is 14.

16.13.1

Steps to Reproduce

CodeSandbox is here: https://codesandbox.io/s/charming-galileo-5mcxy?file=/app/root.tsx

MVP repo is here: https://github.com/revelt/remix-missing-link-load

The context: I'm trying to set a theme toggle on each page in a Remix project.
Problem: "About page" loads a CSS file which colours the text red, but its CSS is not loaded after theme switch (form self-POST).

link-function-not-loading

Steps to reproduce:

  1. npm run dev
  2. Click about page link
  3. Notice the text in red. It's coming from "about" page links function.
  4. Switch the theme.
  5. Notice how after POST-ing to itself, page didn't load the about-styles.css — text is not red.
  6. Refresh — text is red again.

Expected Behavior

I would expect the links function to be automatically called (and all stylesheets included) when page renders after POST-ing to itself.

Actual Behavior

Link function is not called.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions