Skip to content

Commit

Permalink
Fix localstorage adapter hydratation
Browse files Browse the repository at this point in the history
  • Loading branch information
ajnart committed Oct 9, 2024
1 parent c47d014 commit 62533da
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/lib/subscriptionStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const defaultSubscriptions: Subscription[] = [
];

const getStorage = () => {
if (typeof window === 'undefined' || env.NEXT_PUBLIC_USE_SQLITE !== 'true') {
if (typeof window === 'undefined') {
// Return a dummy storage for SSR
return {
getItem: () => Promise.resolve(null),
Expand All @@ -65,6 +65,10 @@ const getStorage = () => {
};
}

if (env.NEXT_PUBLIC_USE_SQLITE === 'false') {
return localStorage;
}

return {
getItem: async (name: string): Promise<string | null> => {
try {
Expand Down

0 comments on commit 62533da

Please sign in to comment.