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

Commit43ce786

Browse files
committed
fix: force organizations to be readonly array
1 parent4956ebb commit43ce786

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

‎site/src/modules/dashboard/DashboardProvider.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export interface DashboardValue {
1919
entitlements:Entitlements;
2020
experiments:Experiments;
2121
appearance:AppearanceConfig;
22-
organizations:Organization[];
22+
organizations:readonlyOrganization[];
2323
showOrganizations:boolean;
2424
}
2525

‎site/src/pages/ManagementSettingsPage/GroupsPage/GroupsPage.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,8 @@ export const GroupsPage: FC = () => {
9999

100100
exportdefaultGroupsPage;
101101

102-
exportconstgetOrganizationNameByDefault=(organizations:Organization[])=>
103-
organizations.find((org)=>org.is_default)?.name;
102+
exportconstgetOrganizationNameByDefault=(
103+
organizations:readonlyOrganization[],
104+
)=>{
105+
returnorganizations.find((org)=>org.is_default)?.name;
106+
};

‎site/src/pages/ManagementSettingsPage/ManagementSettingsLayout.tsx‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import { Outlet } from "react-router-dom";
1212
import{DeploySettingsContext}from"../DeploySettingsPage/DeploySettingsLayout";
1313
import{Sidebar}from"./Sidebar";
1414

15-
typeOrganizationSettingsValue={
16-
organizations:Organization[];
17-
};
15+
typeOrganizationSettingsValue=Readonly<{
16+
organizations:readonlyOrganization[];
17+
}>;
1818

1919
exportconstuseOrganizationSettings=():OrganizationSettingsValue=>{
2020
const{ organizations}=useDashboard();

‎site/src/pages/ManagementSettingsPage/OrganizationSettingsPage.tsx‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const OrganizationSettingsPage: FC = () => {
5050
// Redirect /organizations => /organizations/default-org, or if they cannot edit
5151
// the default org, then the first org they can edit, if any.
5252
if(!organizationName){
53-
consteditableOrg=organizations
53+
consteditableOrg=[...organizations]
5454
.sort((a,b)=>{
5555
// Prefer default org (it may not be first).
5656
// JavaScript will happily subtract booleans, but use numbers to keep
@@ -107,5 +107,9 @@ const OrganizationSettingsPage: FC = () => {
107107

108108
exportdefaultOrganizationSettingsPage;
109109

110-
constgetOrganizationByName=(organizations:Organization[],name:string)=>
111-
organizations.find((org)=>org.name===name);
110+
constgetOrganizationByName=(
111+
organizations:readonlyOrganization[],
112+
name:string,
113+
)=>{
114+
returnorganizations.find((org)=>org.name===name);
115+
};

‎site/src/pages/TemplatePage/TemplateRedirectController.tsx‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,11 @@ export const TemplateRedirectController: FC = () => {
4545
return<Outlet/>;
4646
};
4747

48-
constgetOrganizationNameByDefault=(organizations:Organization[])=>
49-
organizations.find((org)=>org.is_default)?.name;
48+
constgetOrganizationNameByDefault=(
49+
organizations:readonlyOrganization[],
50+
)=>{
51+
returnorganizations.find((org)=>org.is_default)?.name;
52+
};
5053

5154
// I really hate doing it this way, but React Router does not provide a better way.
5255
constremovePrefix=(self:string,prefix:string)=>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp