Skip to content

Update nextjs-page-transition to use runtime style injection#166

Open
michelle-dunson wants to merge 3 commits into
mainfrom
feature/page-transition-runtime-style-injection
Open

Update nextjs-page-transition to use runtime style injection#166
michelle-dunson wants to merge 3 commits into
mainfrom
feature/page-transition-runtime-style-injection

Conversation

@michelle-dunson

Copy link
Copy Markdown
Collaborator

Injects styles into head on mount rather than importing css module for Turbopack compatibility

@vercel

vercel Bot commented Jan 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
haus-core-docs Ignored Ignored Preview Jan 29, 2026 11:36pm

Request Review

@changeset-bot

changeset-bot Bot commented Jan 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0545ec3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@madeinhaus/nextjs-page-transition Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@stevescavo

Copy link
Copy Markdown
Member

@claus are you able to review?

@claus

claus commented Jan 29, 2026

Copy link
Copy Markdown
Member

@stevescavo @michelle-dunson What exactly was the problem? Do i need to know anything else to test this?

Also, this is missing a changeset

@michelle-dunson

Copy link
Copy Markdown
Collaborator Author

What exactly was the problem? Do i need to know anything else to test this?

@claus Turbopack removes css too early and was causing hydration issues with page transitions. Injecting the styles in the head keeps the transitions styles active during transition. I have tested this within the library docs to confirm the styles apply and remain during transition, but I'll still need to test it within the bright-side page transition component.

@claus

claus commented Jan 30, 2026

Copy link
Copy Markdown
Member

I'm still struggling to understand what is happening. Where did you run into this problem? I'd like to reproduce this. Those styles should never get removed. Maybe something weird happens in the useNextCssRemovalPrevention hook? I think that is the most hacky part of the whole PageTransition thing and prone to break in new React versions because it uses very undocumented features.

@michelle-dunson

Copy link
Copy Markdown
Collaborator Author

@claus on bright-side after I upgraded next there were a bunch of css hydration issues because next 16 uses turbopack by default which was causing issues with page transition. I fixed it by just using the --webpack flag, but I had time so I'm trying to fix the actual turbopack issue.

@stevescavo

Copy link
Copy Markdown
Member

@claus do you have some time to review / collaborate on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants