refine time range picker styles and user store#433
Conversation
Review Summary by QodoRefine time range picker styles and user store logic
WalkthroughsDescription• Improved time range picker button styling with ellipsis text overflow handling • Increased HTTP retry queue timeout from 20ms to 200ms for reliability • Refactored user store retrieval to check store value before session storage • Added get import from svelte/store for proper store value access Diagramflowchart LR
A["TimeRangePicker Button"] -- "Add clickable class" --> B["Enhanced Styling"]
A -- "Add text overflow handling" --> C["Ellipsis on Long Text"]
D["HTTP Retry Queue"] -- "Increase timeout 20→200ms" --> E["Better Reliability"]
F["User Store"] -- "Check store value first" --> G["Improved Logic"]
F -- "Add get import" --> G
File Changes1. src/lib/common/shared/TimeRangePicker.svelte
|
Code Review by Qodo
1. Logout token not cleared
|
| const storeValue = get(userStore); | ||
| if (storeValue?.token) { | ||
| return storeValue; | ||
| } | ||
|
|
||
| let json = sessionStorage.getItem(userKey); | ||
| if (json) { | ||
| return JSON.parse(json); | ||
| } else { | ||
| return userStore; | ||
| } | ||
| } else { | ||
| // Return a default value for SSR | ||
| return userStore; | ||
| } | ||
|
|
||
| return get(userStore); |
There was a problem hiding this comment.
1. Logout token not cleared 🐞 Bug ⛨ Security
getUserStore() now returns the in-memory userStore value when it has a token, but logout only clears sessionStorage via resetStorage(true) and never clears userStore, so the SPA can continue sending the old Authorization token after logout. This breaks logout guarantees and can keep a user effectively authenticated until a full reload.
Agent Prompt
### Issue description
Logout calls `resetStorage(true)` which clears `sessionStorage`, but does not clear the in-memory `userStore`. After the PR change, `getUserStore()` prefers `get(userStore)` when it has a token, so the app can keep sending an Authorization header even after logout.
### Issue Context
`axios.interceptors.request.use` reads `getUserStore().token` for every request; therefore logout must clear both persisted and in-memory auth state.
### Fix Focus Areas
- src/lib/helpers/store.js[296-307]
- src/lib/helpers/store.js[37-57]
- src/lib/common/dropdowns/ProfileDropdown.svelte[16-28]
- src/lib/helpers/http.js[105-125]
### Suggested change
- In `resetStorage(resetUser=true)`, call `userStore.set({ id: '', full_name: '', expires: 0, token: null })` (and clear any other user fields used elsewhere, e.g. `renew_token_count`).
- Optionally, update the `userStore.subscribe` persistence logic to `removeItem(userKey)` when `value.token` is falsy to prevent stale resurrection in other flows.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
No description provided.