Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6d83cc1

Browse files
blink-so[bot]sreya
andcommitted
Remove automatic ?resources= URL parameter from workspace page
The workspace page was automatically appending ?resources= to the URLwhen displaying resources. This change modifies the useResourcesNav hookto show the default resource (first resource with agents) withoutsetting the URL parameter automatically.The resource selection still works when explicitly set via URL parameteror user interaction, but no longer pollutes the URL on initial page load.Co-authored-by: sreya <4856196+sreya@users.noreply.github.com>
1 parent44fff54 commit6d83cc1

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

‎site/src/pages/WorkspacePage/useResourcesNav.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,28 @@ export const resourceOptionValue = (resource: WorkspaceResource) => {
1515
// robust implementation.
1616
exportconstuseResourcesNav=(resources:WorkspaceResource[])=>{
1717
constresourcesNav=useSearchParamsKey({key:"resources"});
18+
19+
// Get the default resource (first resource with agents) for display purposes
20+
// without setting it in the URL
21+
constdefaultResource=resources.find(
22+
(resource)=>resource.agents&&resource.agents.length>0
23+
);
24+
constdefaultValue=defaultResource ?resourceOptionValue(defaultResource) :"";
25+
26+
// Use URL value if present, otherwise use default for display
27+
constcurrentValue=resourcesNav.value||defaultValue;
28+
1829
constisSelected=useCallback(
1930
(resource:WorkspaceResource)=>{
20-
returnresourceOptionValue(resource)===resourcesNav.value;
31+
returnresourceOptionValue(resource)===currentValue;
2132
},
22-
[resourcesNav.value],
33+
[currentValue],
2334
);
2435

2536
constonResourceChanges=useEffectEvent(
2637
(resources?:WorkspaceResource[])=>{
27-
consthasSelectedResource=resourcesNav.value!=="";
28-
consthasResources=resources&&resources.length>0;
29-
consthasResourcesWithAgents=
30-
hasResources&&resources[0].agents&&resources[0].agents.length>0;
31-
32-
if(!hasSelectedResource&&hasResourcesWithAgents){
33-
resourcesNav.setValue(resourceOptionValue(resources[0]));
34-
}
38+
// No automatic URL parameter setting - resources are selected for display
39+
// based on URL parameter if present, or default resource if not
3540
},
3641
);
3742
useEffect(()=>{
@@ -48,6 +53,6 @@ export const useResourcesNav = (resources: WorkspaceResource[]) => {
4853
return{
4954
isSelected,
5055
select,
51-
value:resourcesNav.value,
56+
value:currentValue,
5257
};
5358
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp