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