-
Notifications
You must be signed in to change notification settings - Fork 599
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: fast ssr access to globals should be allowed ouside of a request after adding RequestStorageManager middleware #6318
Merged
EisenbergEffect
merged 6 commits into
microsoft:master
from
erhuan-msft:erhuan/dom-shim-update
Aug 26, 2022
Merged
fix: fast ssr access to globals should be allowed ouside of a request after adding RequestStorageManager middleware #6318
EisenbergEffect
merged 6 commits into
microsoft:master
from
erhuan-msft:erhuan/dom-shim-update
Aug 26, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rom getter if not in request scope
…nstead of the shimmed version in async local storage if code is not in storage scope.
chrisdholt
reviewed
Aug 25, 2022
change/@microsoft-fast-ssr-e107db57-9534-4ac4-bd65-157d5b40a79f.json
Outdated
Show resolved
Hide resolved
EisenbergEffect
approved these changes
Aug 25, 2022
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.
Approved pending the small fix to the change file. Thanks for adding the tests!
change/@microsoft-fast-ssr-e107db57-9534-4ac4-bd65-157d5b40a79f.json
Outdated
Show resolved
Hide resolved
nicholasrice
approved these changes
Aug 25, 2022
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.
Thanks @erhuan-msft!
…f.json Co-authored-by: Rob Eisenberg <EisenbergEffect@users.noreply.github.com>
janechu
pushed a commit
that referenced
this pull request
Jun 10, 2024
… after adding RequestStorageManager middleware (#6318) * Updated installDOMShim logic so original global values are returned from getter if not in request scope * Change files * After install DOM Shim, globals will now return the original global instead of the shimmed version in async local storage if code is not in storage scope. * Update change/@microsoft-fast-ssr-e107db57-9534-4ac4-bd65-157d5b40a79f.json Co-authored-by: Rob Eisenberg <EisenbergEffect@users.noreply.github.com> Co-authored-by: Rob Eisenberg <EisenbergEffect@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Pull Request
📖 Description
During integration of fast-ssr
RequestStorageManager
middleware to a SSR server, we discovered access to several globals will throw exceptions if code is not running under storage scope (ie. inside a request). This change will ensure the original global values are assessible outside of a request.This issue was discovered when running unit test on the test server. Jest will try to access and reset the globals within its framework and thereby causing the exceptions to occur.
Thanks to @EisenbergEffect for the discussion and the code snippet.
📑 Test Plan
Unit tests added for change in
installDOMShim
behavior✅ Checklist
General
$ yarn change