-
Notifications
You must be signed in to change notification settings - Fork 9
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(use-storage): using with SSR #2053
base: main
Are you sure you want to change the base?
Conversation
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2053 +/- ##
==========================================
- Coverage 77.48% 76.13% -1.35%
==========================================
Files 25 25
Lines 755 771 +16
Branches 94 97 +3
==========================================
+ Hits 585 587 +2
- Misses 162 175 +13
- Partials 8 9 +1 ☔ View full report in Codecov by Sentry. |
@@ -24,6 +24,34 @@ const canUseDOM = | |||
typeof window.sessionStorage !== 'undefined' | |||
) | |||
|
|||
const createMemoryStorage = (): Storage => { |
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.
Missing unit test on this part
I am using Nextjs 14 and I am receiving some errors on build time because this package are using
window
directly when getting the storage. I created thegetStorage()
function that usecanUseDOM
to check if we can accesswindow
and it returns the corresponding storage.Now I am able to use it with Nextjs.