mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-01 20:20:36 +08:00
bug: bug double org is fixed
This commit is contained in:
parent
53528f1045
commit
12c14f71ba
@ -38,7 +38,7 @@ function DisplayName({
|
|||||||
dispatch({
|
dispatch({
|
||||||
type: UPDATE_ORG_NAME,
|
type: UPDATE_ORG_NAME,
|
||||||
payload: {
|
payload: {
|
||||||
index,
|
orgId,
|
||||||
name: orgName,
|
name: orgName,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -172,16 +172,19 @@ const appReducer = (
|
|||||||
|
|
||||||
case UPDATE_ORG_NAME: {
|
case UPDATE_ORG_NAME: {
|
||||||
const stateOrg = state.org || ({} as OrgPayload);
|
const stateOrg = state.org || ({} as OrgPayload);
|
||||||
const { index, name: updatedName } = action.payload;
|
const { orgId, name: updatedName } = action.payload;
|
||||||
const current = stateOrg[index];
|
|
||||||
|
const orgIndex = stateOrg.findIndex((e) => e.id === orgId);
|
||||||
|
|
||||||
|
const current = stateOrg[orgIndex];
|
||||||
|
|
||||||
const updatedOrg: OrgPayload = [
|
const updatedOrg: OrgPayload = [
|
||||||
...stateOrg.slice(0, index),
|
...stateOrg.slice(0, orgIndex),
|
||||||
{
|
{
|
||||||
...current,
|
...current,
|
||||||
name: updatedName,
|
name: updatedName,
|
||||||
},
|
},
|
||||||
...stateOrg.slice(index + 1, stateOrg.length),
|
...stateOrg.slice(orgIndex + 1, stateOrg.length),
|
||||||
];
|
];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -98,7 +98,7 @@ export interface UpdateOrgName {
|
|||||||
type: typeof UPDATE_ORG_NAME;
|
type: typeof UPDATE_ORG_NAME;
|
||||||
payload: {
|
payload: {
|
||||||
name: string;
|
name: string;
|
||||||
index: number;
|
orgId: string;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user