All files / apps/web/src/utils storage.ts

100% Statements 3/3
100% Branches 4/4
100% Functions 1/1
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16          332x         326x 326x        
import { isServer } from "@tanstack/react-query";
import { del, get, set } from "idb-keyval";
 
import type { Props } from "~app/providers/persist-client";
 
export const storage: Props["storage"] = isServer
	? undefined
	: {
			setItem: set,
			getItem: async (key) => {
				const value = await get<string>(key);
				return value === undefined ? null : value;
			},
			removeItem: del,
		};