andymcbee / saas-base

A SaaS starter with the typical features, using NextJS 14, ExpressJS and Supabase
0 stars 0 forks source link

Bug fix: Do existance check prior to syncing existing cookie id with state #1

Open andymcbee opened 3 hours ago

andymcbee commented 3 hours ago

On app login or page refresh, the auth hook looks for a cookie that contains a currentAccountId value.

We need to add logic to confirm the currentAccountId in cookie exists in the accounts array, otherwise we'll just default to the first in the accounts array and overwrite it.

This issue will cause a user to be stuck in "limbo" if they have a cookie with currentAccId for an account they've been removed from by another user.

andymcbee commented 3 hours ago

If you want to contribute, drop a comment and I'll send you a Loom video of the files in question.