-
Notifications
You must be signed in to change notification settings - Fork 392
DTRA-1880 / Kate / [DTrader-V2] Chunks loading order issue #16829
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
DTRA-1880 / Kate / [DTrader-V2] Chunks loading order issue #16829
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
packages/core/src/App/Containers/Layout/header/dtrader-v2-contract-detail-header.tsx
Outdated
Show resolved
Hide resolved
|
A production App ID was automatically generated for this PR. (log)
Click here to copy & paste above information. |
|
🚨 Lighthouse report for the changes in this PR:
Lighthouse ran with https://deriv-app-git-fork-kate-deriv-kate-dtra-1880fixstyleload-a963cf.binary.sx/ |
| () => <HeaderFallback /> | ||
| )(); | ||
|
|
||
| const DTraderV2ContractDetailsHeader = makeLazyLoader( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue is that styles was overwritten because of the loading order of css. When switching to Contract Details, we lazy-load component with quill styles (in Network a new chunk is added). As they arrive later, they overwrite some original css properties.
|
|
||
| const getLoader = () => | ||
| isDTraderV2() ? ( | ||
| is_dtrader_v2 ? ( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do not want to show loader for V2 in, let's say, trader's hub as isDTraderV2() doesn't check the location
|
| ); | ||
|
|
||
| React.useEffect(() => { | ||
| const html = document?.querySelector('html'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The value of quill tokens is based on css selector: html.light - for light mode, html.dark - for dark mode. At the moment of loading, html tag has no class (for 1 sec), so the value of token is incorrect. Adding class in ui store allows to apply it from the very beginning.
|
⏳ Generating Lighthouse report... |



Changes:
Issue N1
The issue is that styles was overwritten because of the loading order of css. When switching to Contract Details, we lazy-load component with quill styles (in Network a new chunk is added). As they arrive later, they overwrite some original css properties.
What was done: lazy loading was removed.
Issue N2
It turns out, that when Loading.DTraderV2 is rendered (from packages/core/src/App/app.jsx), html tag has no class. I checked quill-ui and quill-tokens and found out that value of the token depends on html tag class: if it's html.light - then the value of the token will be for light mode, if html.dark - for dark mode. In our case html have no class at all for the first second (so the default value of token will be dark) and only after that it gains the proper class.
What was done: added class to html tag in app.jsx (in useEffect) in order to apply it earlier
Screenshots:
Screen.Recording.2024-09-12.at.4.08.24.PM.mov