question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support in ISessionStorage methods promises

See original GitHub issue

At the moment ISessionStorage methods do not support returning session data asynchronously.

It would be good if the implementation can be updated to also allow return Promises with session data as otherwise in react-native it’s not possible to provide custom sessionStorage as the default AsyncStorage in RN is asynchronous by nature.

If that sounds good let me know I can push an update to the codebase.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pedrouidcommented, Apr 25, 2020

Yeah exactly it would require a static async init method, I intend to include a lot of breaking changes with v2.0 so I will make sure to make store async

1reaction
pedrouidcommented, Apr 25, 2020

Damn I just looked through it and there is a breaking change with this feature which will break how sessions are currently recovered from the connector constructor which needs to be synchronous

I would totally make this change if it didn’t break existing integrations.

You can however still implement it on top where you can store WalletConnect sessions mapped by the clientId or peerId (both are unique per session). Here is the example for our react-native demo app.

https://github.com/WalletConnect/walletconnect-demo-app/blob/master/src/helpers/asyncStorage.ts#L44

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Practical Guide to JavaScript sessionStorage
In this tutorial, you'll learn how to use the JavaScript sessionStorage to store data only for a session.
Read more >
Window.sessionStorage - Web APIs - MDN Web Docs
The read-only sessionStorage property accesses a session Storage object for the current origin. sessionStorage is similar to localStorage ...
Read more >
Working with SessionStorage | Learn ECMAScript
Let's now quickly go over all the methods of session storage. Creating a session storage entry. To create a key-value pair inside the...
Read more >
$sessionStorage should return a promise · Issue #185 - GitHub
if $sessionStorage returns before saving the sessionStorage in the browser then we need callback to execute code that relies on sessionStorage.
Read more >
Is any solution to do localstorage setItem in asynchronous way ...
Yes. But this code is synchronous. The methods return a promise but not before the local storage action has completed. – trincot. Jul...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found