You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I define
export const count = syncable('count', 2, false);
an then change the store to 0 I do get 2 back, when I read the store again. Maybe all localstores should be strings? How to deal with that.
The text was updated successfully, but these errors were encountered:
Just tried
export const count = writable( localStorage.getItem("count") || 4 );
count.subscribe(val => localStorage.setItem("count", val ));
and was fine
edit: but only in browser in dev mode. With capacitor on android app freezes an seem not beeing able to load count
If you want to sync also values explicitely set to 0 change line 36 of index.js to lastValue = ( get(key) === "" )? value : get(key);
The condition referes to line 8-10.
When I define
export const count = syncable('count', 2, false);
an then change the store to 0 I do get 2 back, when I read the store again. Maybe all localstores should be strings? How to deal with that.
The text was updated successfully, but these errors were encountered: