fix local storage data

This commit is contained in:
PhilReact 2025-05-05 01:31:15 +03:00
parent 0fbfc8a327
commit 252cd3d377
3 changed files with 5 additions and 6 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "qapp-core", "name": "qapp-core",
"version": "1.0.25", "version": "1.0.26",
"description": "Qortal's core React library with global state, UI components, and utilities", "description": "Qortal's core React library with global state, UI components, and utilities",
"main": "dist/index.js", "main": "dist/index.js",
"module": "dist/index.mjs", "module": "dist/index.mjs",

View File

@ -48,7 +48,7 @@ export const GlobalProvider = ({ children, config, toastStyle = {} }: GlobalProv
const appInfo = useAppInfo(config.appName, config?.publicSalt) const appInfo = useAppInfo(config.appName, config?.publicSalt)
const lists = useResources() const lists = useResources()
const identifierOperations = useIdentifiers(config.publicSalt, config.appName) const identifierOperations = useIdentifiers(config.publicSalt, config.appName)
const persistentOperations = usePersistentStore(config.publicSalt, config.appName, auth?.address) const persistentOperations = usePersistentStore(config.publicSalt, config.appName)
const indexOperations = useIndexes() const indexOperations = useIndexes()
// ✅ Merge all hooks into a single `contextValue` // ✅ Merge all hooks into a single `contextValue`
const contextValue = useMemo(() => ({ auth, lists, appInfo, identifierOperations, persistentOperations, indexOperations }), [auth, lists, appInfo, identifierOperations, persistentOperations]); const contextValue = useMemo(() => ({ auth, lists, appInfo, identifierOperations, persistentOperations, indexOperations }), [auth, lists, appInfo, identifierOperations, persistentOperations]);

View File

@ -4,15 +4,14 @@ import { db } from '../utils/persistentDb';
export const usePersistentStore = ( export const usePersistentStore = (
publicSalt: string, publicSalt: string,
appName: string, appName: string
qortalAddress?: string | null
) => { ) => {
const getHashedId = useCallback( const getHashedId = useCallback(
async (id: string) => { async (id: string) => {
const key = `${appName}-${qortalAddress ?? 'no-address'}-${id}`; const key = `${appName}-${id}`;
return await hashWord(key, EnumCollisionStrength.HIGH, publicSalt); return await hashWord(key, EnumCollisionStrength.HIGH, publicSalt);
}, },
[appName, publicSalt, qortalAddress] [appName, publicSalt]
); );
// --- TIMESTAMP FUNCTIONS --- // --- TIMESTAMP FUNCTIONS ---