Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix navbar and book duplication #1031

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions frontend/src/basic/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ const NavBar = (): JSX.Element => {
navigate('/robot');
setPage('robot');
}
if (isPage(pathPage)) {
setPage(pathPage);
}
}, [location, navigate, setPage, orderUpdatedAt, robotUpdatedAt]);

const handleSlideDirection = function (oldPage: Page, newPage: Page): void {
Expand Down
14 changes: 8 additions & 6 deletions frontend/src/models/Federation.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ export class Federation {
});
};

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

// Setup
start = async (origin: Origin, settings: Settings, hostUrl: string): Promise<void> => {
const onCoordinatorStarted = (shortAlias: string): void => {
const onCoordinatorStarted = (): void => {
this.exchange.onlineCoordinators = this.exchange.onlineCoordinators + 1;
this.onCoordinatorSaved(shortAlias);
this.onCoordinatorSaved();
};
this.loading = true;
for (const coor of Object.values(this.coordinators)) {
Expand All @@ -77,7 +79,7 @@ export class Federation {
this.loading = false;
for (const coor of Object.values(this.coordinators)) {
await coor.update(() => {
this.onCoordinatorSaved(coor.shortAlias);
this.onCoordinatorSaved();
});
}
};
Expand All @@ -86,7 +88,7 @@ export class Federation {
this.loading = false;
for (const coor of Object.values(this.coordinators)) {
await coor.updateBook(() => {
this.onCoordinatorSaved(coor.shortAlias);
this.onCoordinatorSaved();
});
}
};
Expand Down
Loading