Skip to content

Commit

Permalink
fix: getChain
Browse files Browse the repository at this point in the history
  • Loading branch information
cs1707 committed May 30, 2024
1 parent fc97cd0 commit 571fe67
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ui/views/History/components/HistoryItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const HistoryItem = ({
const account = useRabbySelector((state) => state.account.currentAccount);

if (!chainItem) {
return null;
return <div></div>;
}

return (
Expand Down
6 changes: 4 additions & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CHAINS } from '@/constant';
import { keyBy } from 'lodash';
import browser from 'webextension-polyfill';
import { findChain } from './chain';

declare global {
const langLocales: Record<string, Record<'message', string>>;
Expand All @@ -14,12 +15,13 @@ const format = (str, ...args) => {

export { t, format };

const chainsDict = keyBy(CHAINS, 'serverId');
export const getChain = (chainId?: string) => {
if (!chainId) {
return null;
}
return chainsDict[chainId];
return findChain({
serverId: chainId,
});
};

export const getOriginFromUrl = (url: string) => {
Expand Down

0 comments on commit 571fe67

Please sign in to comment.