[WEB-2807] fix: Root issue store to have updated url params at all times#6147
[WEB-2807] fix: Root issue store to have updated url params at all times#6147
Conversation
WalkthroughThe pull request modifies the Changes
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🔇 Additional comments (1)web/core/store/issue/root.store.ts (1)
The conditional checks prevent unnecessary state updates and should fix the module disappearance issue. The implementation is consistent across all URL parameters. Consider extracting the URL parameter sync logic into a helper function to reduce repetition and improve maintainability: + private syncUrlParam<T>(currentValue: T | undefined, routerValue: T | undefined, key: keyof this) {
+ if (currentValue !== routerValue) {
+ (this[key] as T | undefined) = routerValue;
+ }
+ }
autorun(() => {
if (rootStore?.user?.data?.id) this.currentUserId = rootStore?.user?.data?.id;
- if (this.workspaceSlug !== rootStore.router.workspaceSlug) this.workspaceSlug = rootStore.router.workspaceSlug;
- if (this.projectId !== rootStore.router.projectId) this.projectId = rootStore.router.projectId;
- if (this.cycleId !== rootStore.router.cycleId) this.cycleId = rootStore.router.cycleId;
- if (this.moduleId !== rootStore.router.moduleId) this.moduleId = rootStore.router.moduleId;
- if (this.viewId !== rootStore.router.viewId) this.viewId = rootStore.router.viewId;
- if (this.globalViewId !== rootStore.router.globalViewId) this.globalViewId = rootStore.router.globalViewId;
- if (this.userId !== rootStore.router.userId) this.userId = rootStore.router.userId;
+ this.syncUrlParam(this.workspaceSlug, rootStore.router.workspaceSlug, 'workspaceSlug');
+ this.syncUrlParam(this.projectId, rootStore.router.projectId, 'projectId');
+ this.syncUrlParam(this.cycleId, rootStore.router.cycleId, 'cycleId');
+ this.syncUrlParam(this.moduleId, rootStore.router.moduleId, 'moduleId');
+ this.syncUrlParam(this.viewId, rootStore.router.viewId, 'viewId');
+ this.syncUrlParam(this.globalViewId, rootStore.router.globalViewId, 'globalViewId');
+ this.syncUrlParam(this.userId, rootStore.router.userId, 'userId');Let's verify that the router values are properly typed: ✅ Verification successfulBased on the search results, I can now generate the final response. The router store implementation shows proper type definitions with the interface LGTM with verified type safety! Consider helper function for maintainability. The implementation is type-safe and the conditional checks prevent unnecessary state updates. The router values are properly typed through the Consider extracting the URL parameter sync logic into a helper function to reduce repetition: private syncUrlParam(currentValue: string | undefined, routerValue: string | undefined, key: keyof this) {
if (currentValue !== routerValue) {
(this[key] as string | undefined) = routerValue;
}
}🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check if router values are properly typed
# Expected: Find the router interface definition to ensure type safety
# Search for router interface definition
ast-grep --pattern 'interface $ROUTER_TYPE {
$$$
workspaceSlug: $_
projectId: $_
cycleId: $_
moduleId: $_
viewId: $_
globalViewId: $_
userId: $_
$$$
}'
Length of output: 171 Script: #!/bin/bash
# Let's try a different approach to find router-related type definitions
# First, let's find the router store definition
ast-grep --pattern 'class $_ {
$$$
workspaceSlug: $_
projectId: $_
$$$
}'
# Also search for any type definitions related to router
rg "type.*Router|interface.*Router" -A 5
Length of output: 65995 Script: #!/bin/bash
# Let's search for the router store implementation to verify type safety
rg "class RouterStore|interface IRouterStore" -A 10 web/core/store/router.store.ts
# Also search for the store's properties
ast-grep --pattern 'class RouterStore {
$$$
workspaceSlug: $_
projectId: $_
cycleId: $_
moduleId: $_
viewId: $_
globalViewId: $_
userId: $_
$$$
}'
Length of output: 817 Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This PR fixes the issues disappearing while untagging modules of the issue under certain conditions. The root cause for this was the out dated url params in Root Issue store. That is being fixed in this PR to have updated url params in Root Issue store
Summary by CodeRabbit