fastify-session
fastify-session copied to clipboard
Multiple overlapping requests cause session data to be lost
If multiple requests arrive at the same time (eg XHR), then the session data is loaded from the store at the start of each request and then saved; however, this means that the request.session object is a duplicate for each request, and therefore the two different requests will make independent changes. When the session data is stored at the end of each request, whatever changes were in the first store will be overwritten by the second.