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.

Proposal to improve the experience of `useSession`

See original GitHub issue

Describe the feature

Hi! I’m João Pedro. I’m one of the maintainers of the nuxt 2 auth module 😃

So, currently, each time useSession is used it makes a request to the api to get the session, which means we have to await for the request and this makes the component asynchronous. And if it’s used in more than one component, it will make unnecessary requests.

My proposal is to use useSession only to get the data stored with useState, and fetch the session on load the page through a plugin.

This follows the same approach of the auth module, which fetches the user on load the auth plugin.

Additional information

No response

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:2
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BracketJohncommented, Dec 1, 2022

I’ve gotten started (and already quite far) in #69. #69 will:

  • make session sync
  • use a plugin for session init,
  • add a module-middleware that people can use,
  • adds refresh options:
    • periodically,
    • on window focus

for another PR / issue:

  • broadcasting
1reaction
BracketJohncommented, Dec 1, 2022

As discussed: Let’s go ahead with this and make useSession sync (:

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enhance user experience with simple and easy-to-use ...
Quick and easy visualization of user session information across your applications is crucial for ensuring a great user experience. Improve ...
Read more >
How-To Videos - Session
In this video you will learn how to define which days and hours you're available for booking. See how your clients experience Session....
Read more >
Five Tips for AU 2022 Proposal Success | Autodesk University
5. Emphasize your unique contribution ... What makes your class different from all the rest? What unique insight or experience or approach will ......
Read more >
Cookie Policy - The Learning Ideas Conference
Anyone visiting our site may receive cookies from us. We use session cookies to improve your experience on this site. The Learning Ideas...
Read more >
Proposals - National Resource Center for The First-Year ...
Proposals. The National Resource Center invites online proposal submissions. Concurrent sessions, facilitated dialogues, and vendor presentation proposals ...
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