Skip to content

Commit 16a16da

Browse files
authored
Fix navbar and book duplication (#1031)
1 parent 7648fa9 commit 16a16da

File tree

3 files changed

+84
-123
lines changed

3 files changed

+84
-123
lines changed

frontend/src/basic/NavBar/NavBar.tsx

-3
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ const NavBar = (): JSX.Element => {
6262
navigate('/robot');
6363
setPage('robot');
6464
}
65-
if (isPage(pathPage)) {
66-
setPage(pathPage);
67-
}
6865
}, [location, navigate, setPage, orderUpdatedAt, robotUpdatedAt]);
6966

7067
const handleSlideDirection = function (oldPage: Page, newPage: Page): void {

frontend/src/models/Federation.model.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ export class Federation {
5151
});
5252
};
5353

54-
onCoordinatorSaved = (shortAlias: string): void => {
55-
this.book = [...this.book, ...this.getCoordinator(shortAlias).book];
54+
onCoordinatorSaved = (): void => {
55+
this.book = Object.values(this.coordinators).reduce<PublicOrder[]>((array, coordinator) => {
56+
return [...array, ...coordinator.book];
57+
}, []);
5658
this.loading = false;
5759
this.triggerHook('onCoordinatorUpdate');
5860
if (Object.values(this.coordinators).every((coor) => coor.isUpdated())) {
@@ -63,9 +65,9 @@ export class Federation {
6365

6466
// Setup
6567
start = async (origin: Origin, settings: Settings, hostUrl: string): Promise<void> => {
66-
const onCoordinatorStarted = (shortAlias: string): void => {
68+
const onCoordinatorStarted = (): void => {
6769
this.exchange.onlineCoordinators = this.exchange.onlineCoordinators + 1;
68-
this.onCoordinatorSaved(shortAlias);
70+
this.onCoordinatorSaved();
6971
};
7072
this.loading = true;
7173
for (const coor of Object.values(this.coordinators)) {
@@ -77,7 +79,7 @@ export class Federation {
7779
this.loading = false;
7880
for (const coor of Object.values(this.coordinators)) {
7981
await coor.update(() => {
80-
this.onCoordinatorSaved(coor.shortAlias);
82+
this.onCoordinatorSaved();
8183
});
8284
}
8385
};
@@ -86,7 +88,7 @@ export class Federation {
8688
this.loading = false;
8789
for (const coor of Object.values(this.coordinators)) {
8890
await coor.updateBook(() => {
89-
this.onCoordinatorSaved(coor.shortAlias);
91+
this.onCoordinatorSaved();
9092
});
9193
}
9294
};

0 commit comments

Comments
 (0)