Storage Utilities

Check if named state is saved and retrieve actual storage and saved key information.


hasRxState

Specify name and storage options to check if a value exists at that location as a boolean.

ts
const exists = await hasRxState("count", {
  storage: "sessionstorage",
});
// boolean

findRxStateStorages

If only the name is provided, it returns an array of actual storage backends without duplicates. Values saved as auto will also return as the actual selected backend.

ts
const storages = await findRxStateStorages("count");
// RxStateResolvedStorage[]
// 예: ["indexeddb", "localstorage", "sessionstorage"]

getRxStateStorageInfo

Always returns confirmed storage locations as an array. If the same name exists in multiple storages or different name/storeName/keyPrefix settings, each will be returned as a separate item. You can pass storage options as the second argument to query under those conditions.

ts
const infos = await getRxStateStorageInfo("count");

const indexedDbInfos = await getRxStateStorageInfo("count", {
  storage: "indexeddb",
});
// RxStateStorageInfo[]
ts
interface RxStateStorageInfo {
  key: string;
  storageKey: string;
  fullKey: string;
  storage: RxStateResolvedStorage;
  name: string;
  storeName: string;
  keyPrefix: string;
}

storageKey is the item key passed to storage, and fullKey is the complete key that can be checked in backends exposing flat keys like localStorage. The storage will return the actual backend, not auto.

Actual operation test

You can save the same test key in multiple storages using the button below and immediately check the return values of the three APIs.

Save test value

After saving the same name in multiple storages, you can check the actual return values of the three utilities.


Lookup storage
Not executed yet.

Reducer storage utilities

Reducer also provides hasRxReducer, findRxReducerStorages, and getRxReducerStorageInfo in the same way.

ts
await hasRxReducer("cart", { storage: "sessionstorage" });
await findRxReducerStorages("cart");
await getRxReducerStorageInfo("cart");
await getRxReducerStorageInfo("cart", { storage: "indexeddb" });
© 2026 Byeolnaerim. All rights reserved.IntroductionPrivacy Policy