We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi! Can you provide the method MultiGet like 'react-native/AsyncStorage' ?
The text was updated successfully, but these errors were encountered:
Be warned: You must use SecureStorage sequentially.
This function does not work:
async function multiGet(keys) { return await Promise.all(keys.map(SecureStorage.getItem)); }
Use this function instead:
async function multiGet(keys) { var acc = {}; for (var key of keys) { await new Promise((res, rej) => setTimeout(res, 100)); // sleep for 100ms acc[key] = await SecureStorage.getItem(key); } return acc; }
Edit: this applies to getItem and removeItem and may apply to getAllKeys and setItem as well.
getItem
removeItem
getAllKeys
setItem
Edit 2: it looks like SecureStorage functions cannot be fired in quick succession. There needs to be a delay added.
Edit 3: I suggest using JSON.stringify to store multiple keys if at all possible to avoid the delay.
JSON.stringify
Sorry, something went wrong.
No branches or pull requests
Hi!
Can you provide the method MultiGet like 'react-native/AsyncStorage' ?
The text was updated successfully, but these errors were encountered: