Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita2f22a6

Browse files
committed
(fix): throw an error if no storage is configured
- if the localStorage default is unsupported in the current environment (e.g. Node), then it should throw with a specific error instead of continuing and unexpectedly throwing on getItem - will still error out, so not a "fix" in that sense, but it now will throw a better, more understandable error
1 parent63053b9 commita2f22a6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

‎src/index.ts‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ export const persist: IArgs = (name, store, options = {}) => {
2424
){
2525
storage=AsyncLocalStorage
2626
}
27+
if(!storage){
28+
returnPromise.reject('localStorage (the default storage engine) is not '+
29+
'supported in this environment. Please configure a different storage '+
30+
'engine via the `storage:` option.')
31+
}
32+
2733
if(!jsonify){jsonify=true}// default to true like mobx-persist
2834
constwhitelistDict=arrToDict(whitelist)
2935
constblacklistDict=arrToDict(blacklist)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp