mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-07 03:20:19 -06:00
memory stuff
This commit is contained in:
@@ -1,26 +1,21 @@
|
||||
import { MMKV } from "react-native-mmkv";
|
||||
import { createSyncStoragePersister } from "@tanstack/query-sync-storage-persister";
|
||||
import { persistQueryClient } from "@tanstack/react-query-persist-client";
|
||||
import { queryClient } from "./query-client";
|
||||
|
||||
export const storage = new MMKV();
|
||||
|
||||
const clientStorage = {
|
||||
setItem: (key: string, value: string | number | boolean | Uint8Array) => {
|
||||
storage.set(key, value);
|
||||
},
|
||||
getItem: (key: string) => {
|
||||
const value = storage.getString(key);
|
||||
return value === undefined ? null : value;
|
||||
},
|
||||
removeItem: (key: string) => {
|
||||
storage.delete(key);
|
||||
},
|
||||
};
|
||||
setItem: (key: string, value: string | number | boolean | Uint8Array) => {
|
||||
storage.set(key, value);
|
||||
},
|
||||
getItem: (key: string) => {
|
||||
const value = storage.getString(key);
|
||||
return value === undefined ? null : value;
|
||||
},
|
||||
removeItem: (key: string) => {
|
||||
storage.delete(key);
|
||||
},
|
||||
};
|
||||
|
||||
export const clientPersister = createSyncStoragePersister({ storage: clientStorage });
|
||||
|
||||
persistQueryClient({
|
||||
queryClient,
|
||||
persister: clientPersister
|
||||
});
|
||||
export const clientPersister = createSyncStoragePersister({
|
||||
storage: clientStorage,
|
||||
});
|
||||
Reference in New Issue
Block a user