Commit e2cb0e5
authored
fix: o(n) requests on project switch + perisstance (#801)
### TL;DR
Improved project selection logic and optimized query cache clearing when switching projects.
closes #798
### What changed?
- Enhanced project selection logic to maintain the current project when switching accounts if it's available in the new account's scoped teams
- Added `setStep` to the dependency arrays in `useActionSelectorState` to ensure proper reactivity
- Modified query cache clearing behavior when switching projects to only remove project-specific queries while preserving project list and user data
- Added proper handling of available project IDs when authenticating
### How to test?
1. Log in with an account that has access to multiple projects
2. Switch between projects and verify that the current project is maintained if available in both accounts
3. Verify that the project switcher still shows the correct list of available projects after switching
4. Check that navigation to task input works correctly after project selection
### Why make this change?
This change improves the user experience when switching between projects by:
1. Maintaining context when possible (keeping the same project if available)
2. Preserving necessary data in the query cache to avoid unnecessary refetching
3. Ensuring the project switcher has the correct data available immediately1 parent 8ed3253 commit e2cb0e5
2 files changed
Lines changed: 20 additions & 5 deletions
File tree
- apps/twig/src/renderer
- components/action-selector
- features/auth/stores
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
248 | 249 | | |
249 | 250 | | |
250 | 251 | | |
| |||
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| 295 | + | |
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
262 | 262 | | |
263 | 263 | | |
264 | 264 | | |
| 265 | + | |
| 266 | + | |
265 | 267 | | |
266 | | - | |
267 | | - | |
268 | | - | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
269 | 271 | | |
270 | 272 | | |
271 | 273 | | |
| |||
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
291 | 297 | | |
292 | 298 | | |
293 | 299 | | |
| |||
665 | 671 | | |
666 | 672 | | |
667 | 673 | | |
668 | | - | |
669 | | - | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
670 | 683 | | |
671 | 684 | | |
672 | 685 | | |
| |||
0 commit comments