Skip to content
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

[Nextjs] cssinjs flicker in streaming mode #46533

Closed
infodusha opened this issue Dec 19, 2023 · 5 comments
Closed

[Nextjs] cssinjs flicker in streaming mode #46533

infodusha opened this issue Dec 19, 2023 · 5 comments

Comments

@infodusha
Copy link

infodusha commented Dec 19, 2023

Reproduction link

https://github.com/infodusha/antd-next-streaming-issue

Steps to reproduce

Have a streamed page with timeout, that you directly navigate, and you already rendered some styles before the streaming

What is expected?

There is no flicker

What is actually happening?

There is a flicker when page is loaded directly.

Environment Info
antd 5.12.4
@ant-design/cssinjs 1.18.1
React 18.2.0
System MacOS
Browser Chrome 120
@infodusha
Copy link
Author

Screen.Recording.2023-12-19.at.12.31.13.mov

@infodusha infodusha changed the title [Nextjs] cssinjs deduplicate logic makes flicker in streaming mode [Nextjs] cssinjs flicker in streaming mode Dec 19, 2023
@infodusha
Copy link
Author

The bug was also mentioned in #45955 if anyone wants a workaround

@MadCcc
Copy link
Member

MadCcc commented Dec 20, 2023

- "@ant-design/cssinjs": "1.17.2"
+ "@ant-design/cssinjs": "^1.17.2"

DO NOT lock cssinjs version, it will cause multiple instances.

@MadCcc MadCcc closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2023
@infodusha
Copy link
Author

infodusha commented Dec 20, 2023

@MadCcc sorry to bother you

I have updated the repo to have the same (and latest ) version of cssinjs but the bug is still there
image
Could you please reopen?

@infodusha
Copy link
Author

The issue seems to be related with deduplication logic copied from getting stared guide:

// avoid duplicate css insert
if (isServerInserted.current) {
  return;
}

I would expect it to use cache to detect if anything was changed and what css should be added when streaming
Otherwise it seems to cut off streaming part, but if i will remove the logic it may result multiple style tags with same id inserted

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

No branches or pull requests

2 participants