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(storage-plugin): access local and session storages globals only in browser #2034
Conversation
if (!isInitOrUpdateAction || (isInitOrUpdateAction && hasMigration)) { | ||
for (const { key, engine } of this._keysWithEngines) { | ||
let storedValue = nextState; | ||
if (isInitOrUpdateAction && !hasMigration) { |
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.
no updates here, just made an early return to make it more readable
BundleMonUnchanged files (3)
No change in files bundle size Unchanged groups (3)
Final result: ✅ View report in BundleMon website ➡️ |
BundleMon (NGXS Plugins)Files updated (2)
Unchanged files (12)
Total files change +11B +0.02% Groups updated (3)
Final result: ✅ View report in BundleMon website ➡️ |
BundleMon (Integration Projects)Files updated (2)
Unchanged files (1)
Total files change +74B +0.04% Final result: ✅ View report in BundleMon website ➡️ |
6304652
to
a002c2b
Compare
☁️ Nx Cloud ReportCI is running/has finished running commands for commit b3ea53c. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 3 targetsSent with 💌 from NxCloud. |
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.
LGTM. Would be nice to add a small PR description with 1 or 2 lines of motivation. What are the usages that we don't have a browser?
…n browser This commit modifies the factory functions for the `LOCAL_STORAGE_ENGINE` and `SESSION_STORAGE_ENGINE` tokens. Previously, these functions resolved to `localStorage` and `sessionStorage`, which caused an error when executing the code in a server-side environment where localStorage is not defined. To address this, we have implemented a check to determine if the code is running in a browser environment before retrieving the `localStorage`.
a002c2b
to
b3ea53c
Compare
Code Climate has analyzed commit b3ea53c and detected 3 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 86.2% (50% is the threshold). This pull request will bring the total coverage in the repository to 96.7% (0.0% change). View more on Code Climate. |
This commit modifies the factory functions for the
LOCAL_STORAGE_ENGINE
and
SESSION_STORAGE_ENGINE
tokens. Previously, these functions resolvedto
localStorage
andsessionStorage
, which caused an error when executingthe code in a server-side environment where localStorage is not defined.
To address this, we have implemented a check to determine if the code is
running in a browser environment before retrieving the
localStorage
.