Skip to content

Interaction between Remix, Lastpass, and <link rel=stylesheet> and (possibly) @import #4175

Closed as not planned
@giltayar

Description

@giltayar

What version of Remix are you using?

1.7.0

Steps to Reproduce

  1. Install Lastpass (I think you should also be registered...?)
  2. git clone https://github.com/giltayar/remix-import-css-lastpass-hydration-error-reproduction
  3. npm install
  4. npm run dev
  5. This should show the page with no errors in console

Now...

  1. Edit root.tsx and comment in the <link rel=stylesheet>.

Or...

  1. Edit root.tsx and comment in the <style> tag.

Expected Behavior

Opening the page in Chrome or Firefox: No errors in the console

Actual Behavior

Errors in console*:

For Firefox, DevTools must be open (with "disable cache" checked in the Network tab). For Chrome, even closed will trigger the problematic behavior (!)

Uncaught Error: Hydration failed because the initial UI does not match what was rendered on the server

and...

.
link
Scripts@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:2851:7
body
html
App
RemixRoute@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:2529:20
Routes2@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:2513:7
Router@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:741:7
RemixCatchBoundary@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:1018:28
RemixErrorBoundary@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:944:5
RemixEntry@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:2406:20
RemixBrowser@http://localhost:3000/build/_shared/chunk-IMF64WG6.js:3150:27

Note that the error also happened to me when using a @import in an "emotion css" global rule (that is how I found it out). After much research, I found the problem also occurs with link rel. You have a reproduction of both in this repo.

Also note that Lastpass Definitely triggers the problem, but playing around with this reproduction shows me that all the other parameters are fluid in regards to reproducability:

  1. Whether Chrome or Firefox
  2. Whether devtools is open
  3. Whether "disable cache" is turned on
  4. Whether using links function, link rel in head, or using @import.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions