Skip to content

chrome.storage.local.get doesn't return the initial values #473

Description

@Othmanosx

when providing an initial value to the createChromeStorageStateHookLocal hook, and trying to access the data from chrome.storage.local.get, it returns undefined instead of the initial false.
P.S.: the hook is already mounted by the timechrome.storage.local.get was called.

export const SETTINGS_KEY = 'settings';
const INITIAL_VALUE = {
  isDark: false,
};

export const useSettingsStore = createChromeStorageStateHookLocal(SETTINGS_KEY, INITIAL_VALUE);
  chrome.storage.local.get([SETTINGS_KEY], async function (result) {
      console.log(result.isDark) // undefined
  });

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions