Studio's sign-out never called the API to clear the HttpOnly telemetry
cookies (`user_id`, `organization_slug`, `project_ref`). Events sent
from the sign-in page after a sign-out were still recorded under the
user who had just signed out, and the next user on that browser
inherited the previous user's org and project cookies. I call the
existing `resetServerTelemetryCookies` helper (already used when consent
is withdrawn) from `useSignOut`, right after the auth sign-out, and only
when a session existed. A stored session whose refresh fails during
sign-out counts as existing.
**Note:** `withAuth` also calls `useSignOut` when a visitor with no
session opens a protected page. I skip the reset there because the
endpoint also clears the anonymous id and session id cookies, and a
visitor who has not signed in yet needs them until sign-in links them to
the account. When the reset does run, I make sign-out wait for it
(capped at 1 second by the helper) so the sign-in page cannot send an
event with the old cookies first.
## To test
Tested on the PR preview:
- [x] Sign in, open the network tab, then click "Sign out" in the avatar
menu: expect one `POST /platform/telemetry/reset` with a 2xx response.
Observed: one reset request (201), sent right after the auth `logout`
request (204).
- [x] While signed out, open a protected page such as
`/dashboard/organizations`: expect a redirect to sign-in and no `POST
/platform/telemetry/reset`. Observed: redirect to
`/dashboard/sign-in?returnTo=%2Forganizations`, no reset request.
The preview is cross-site to the staging API, so the browser never
stores these `SameSite=Lax` cookies there and the cookie-clearing effect
cannot be observed on it. I'll check that on the staging dashboard after
merge.
## Linear
- fixes GROWTH-1556
- Add reset() method to PostHogClient class to clear user identification
- Call posthogClient.reset() before clearLocalStorage() in signout flow
- Include proper error handling and memory leak prevention
- Clear all pending state (identification, groups, events)
Resolves GROWTH-535
When user logs out from the user dropdown, they're redirected to the
sign-in page via the withAuth redirect, which means that the returnTo
param is used -- but if the user _intentionally_ logged out, this might
not be the right behavior, i.e., if they want to log in to another
account. Instead, if they chose to log out, we shouldn't use the
returnTo param.
Since the /logout page already implements this behavior, I changed "Log
out" button to just route to the /logout page.
* docs: user nav dropdown
* www: user dropdown nav
* update menus
* chore: add complete local storage allowlist
* move all local-storage to common
* reload after logOut
* add local storage key changes from #35175
* fix errors
* add more keys
* fix merge bugs
---------
Co-authored-by: Alaister Young <a@alaisteryoung.com>
* Update the design of the sonner toasts. Add the close button by default.
* Migrate studio and www apps to use the SonnerToaster.
* Migrate all toasts from studio.
* Migrate all leftover toasts in studio.
* Add a new toast component with progress. Use it in studio.
* Migrate the design-system app.
* Refactor the consent toast to use sonner.
* Switch docs to use the new sonner toasts.
* Remove toast examples from the design-system app.
* Remove all toast-related components and old code.
* Fix the progress bar in the toast progress component. Also make the bottom components vertically centered.
* Fix the width of the toast progress.
* Use text-foreground-lighter instead of muted for ToastProgress text
* Rename ToastProgress to SonnerProgress.
* Shorten the text in sonner progress.
* Use the correct classes for the close button. Add a const var for the default toast duration. Remove the custom width class from sonner.
* Set the position for all progress toasts to bottom right. Set the duration for all toasts to the default (when reusing a toast id from loading/progress toast, the duration is set to infinity).
* Fix the playwright tests.
* Refactor imports to use ui instead of @ui.
* Change all imports of react-hot-toast with sonner. These components were merged since the last commit to this branch.
* Remove react-hot-toast lib.
---------
Co-authored-by: Joshen Lim <joshenlimek@gmail.com>
Co-authored-by: Jonathan Summers-Muir <MildTomato@users.noreply.github.com>
* Move all studio files from /studio to /apps/studio.
* Move studio specific prettier ignores.
* Fix the ui references from studio.
* Fix the css imports.
* Fix all package.json issues.
* Fix the prettier setup for the studio app.
* Add .turbo folder to prettierignore.
* Fix the github workflows.