-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dropped styles on route transition #1272
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Size Change: +528 B (+0.05%) Total Size: 1.04 MB
ℹ️ View Unchanged
|
i'd love to have an error handler we could pass in to rrweb so we could log errors like this - they're so difficult to find! |
@pauldambra totally agree, that would be great to have. This technically isn't an error. It is expected that a stylesheet shouldn't be found for links to JS files. I'm somewhat special casing things here in cases when there is a |
@MathiasWP that's super weird, I don't see a reference to |
A fix has just been merged in #1275. Thanks for reporting this @MathiasWP |
Problem
Relates to https://posthoghelp.zendesk.com/agent/tickets/14512 (and probably a bunch more support tickets)
This could also be related to rrweb-io/rrweb#1230
Addresses an issue in recordings where styles were being dropped during some route changes in SPAs
Reproduction
It's not fully clear to me how this happens or what the correct behaviour is but the problem exists when:
This gets loaded into the documents
styleSheets
array with the href set ashttps://domainname.com/_app/immutable/assets/filename.css
Sometime later the domain changes away from the index page to another root e.g.
https://domainname.com/home
When taking the next full snapshot rrweb tries to fetch the stylesheet associated with the href:
n.href
now evaluates tohttps://domainname.com/home/_app/immutable/assets/filename.css
which no longer matches thehref
of the stylesheet on the document and hence cannot be "found". Presumably the href on the document stylesheet does not change because the SPA is not doing a full page transitionChanges
This PR adds a backup check to look for the CSS on the root of the domain
This feels like the safest change for now but will get the opinion of others in the rrweb community too