Skip to content

Commit 1ef93d8

Browse files
authored
Merge pull request #1559 from RoboSats/fix-bugs-after-libraries-updates
Fix bugs after libraries updates
2 parents fa8a633 + e84fa95 commit 1ef93d8

File tree

5 files changed

+23
-11
lines changed

5 files changed

+23
-11
lines changed

frontend/package-lock.json

+18-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/src/components/BookTable/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ const BookTable = ({
9292

9393
const { t } = useTranslation();
9494
const theme = useTheme();
95-
const orders = orderList ?? Object.values(federation.book);
95+
const orders = orderList ?? Object.values(federation.book) ?? [];
9696

9797
const [paginationModel, setPaginationModel] = useState<GridPaginationModel>({
9898
pageSize: 0,

frontend/src/contexts/FederationContext.tsx

+2-6
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,9 @@ export const FederationContextProvider = ({
5959
if (client !== 'mobile' || torStatus === 'ON' || !settings.useProxy) {
6060
void federation.updateUrl(origin, settings, hostUrl);
6161
void federation.loadLimits();
62+
federation.setConnection(settings);
6263
}
63-
}, [settings.network, settings.useProxy, torStatus]);
64-
65-
useEffect(() => {
66-
federation.setConnection(settings);
67-
}, [settings.connection]);
64+
}, [settings.network, settings.useProxy, torStatus, settings.connection]);
6865

6966
const addNewCoordinator: (alias: string, url: string) => void = (alias, url) => {
7067
if (!federation.coordinators[alias]) {
@@ -90,7 +87,6 @@ export const FederationContextProvider = ({
9087
setCoordinatorUpdatedAt(new Date().toISOString());
9188
});
9289
garage.syncCoordinator(federation, alias);
93-
setSortedCoordinators(federationLottery(federation));
9490
setFederationUpdatedAt(new Date().toISOString());
9591
}
9692
};

frontend/src/models/Federation.model.ts

-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export class Federation {
8080

8181
setConnection = (settings: Settings): void => {
8282
this.connection = settings.connection;
83-
8483
if (this.connection === 'nostr') {
8584
this.roboPool.connect();
8685
this.loadBookNostr();

frontend/src/utils/filterOrders.ts

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ const filterOrders = function ({
7070
.filter((coord) => coord.enabled)
7171
.map((coord) => coord.shortAlias);
7272
const filteredOrders = Object.values(federation.book).filter((order) => {
73+
if (!order) return false;
74+
7375
const coordinatorCheck = enabledCoordinators.includes(order.coordinatorShortAlias ?? '');
7476
const typeChecks = order.type === baseFilter.type || baseFilter.type == null;
7577
const modeChecks = baseFilter.mode === 'fiat' ? !(order.currency === 1000) : true;

0 commit comments

Comments
 (0)