Replies: 2 comments
-
Implementation: |
Beta Was this translation helpful? Give feedback.
0 replies
-
Creating a session when the user has no intention of logging in is a waste of resources. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
getSession
always runscreateSession
whenreadData
cannot find a corresponding entry.Another method that does not run
createSession
in such a case is required when you develop a member-only application and expose its login page to the public.If
createSession
is called too many times (e.g. by DoS attack), the performance of a database can be degraded, especially when you use only RDBMS and do not combine it with KVS NoSQL (e.g. Redis/Valkey).vs
react-router/packages/react-router/lib/server-runtime/sessions.ts
Lines 266 to 270 in 255ac96
The current
getSession
will perform a wasteful operation even if an user has no merit to receive a session data.vs
As you might notice, it returns just
null
without creating new one when no entry.This will not be a breaking change unless you use third party session libraries. However, an author of a third party session library have to modify their library to implement this method. Unfortunately JavaScript/TypeScript cannot provide default method implementations in an interface unlike Java or C#.
Beta Was this translation helpful? Give feedback.
All reactions