-
Notifications
You must be signed in to change notification settings - Fork 197
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
Initialize the stores only on the server #5046
Conversation
Latest k6 run output1
Footnotes
|
476fbc4
to
5215c3a
Compare
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.
I was able to confirm that requests to the /stats
endpoints aren't being made when I visit the homepage locally 🥳
This PR makes the
init-stores
plugin run only on the server.
Just curious, was this done simply by changing .ts
to .server.ts
in the plugin name? Will doing this have any affect on any of the other data in the store? Things like dark mode or sensitivity preferences?
Yes, simply by adding the |
Thanks for that explanation! |
Fixes
Fixes #5037 by @obulat
Description
This PR makes the
init-stores
plugin run only on the server.We don't need to run it both on the server and on the client because the cookie values don't change from the server to client rendering. We also do not need to re-fetch the providers since they were fetched on the server.
This PR also adds numbers to the plugin names to ensure that the order of execution is correct on the server:
01.api-token
-02.init-stores
- other plugins. The token is necessary for fetching the providers, and the stores need to be initialized before anything elseThe other plugins do not depend on each other, so there I removed numbers from their names.
Testing Instructions
Run the app and check the browser devtools Network tab for requests. There should be no
stats
requests since they are sent on the server (and thus, don't show up in the browser devtools).Checklist
Update index.md
).main
) or a parent feature branch.ov just catalog/generate-docs
for catalogPRs) or the media properties generator (
ov just catalog/generate-docs media-props
for the catalog or
ov just api/generate-docs
for the API) where applicable.Developer Certificate of Origin
Developer Certificate of Origin