Skip to content

Commit

Permalink
address more requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeRx committed Dec 17, 2024
1 parent a73a132 commit 44fb407
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions ui/hooks/snaps/useSnapSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ export function useSnapSettings({ snapId }: { snapId?: string }) {

useEffect(() => {
let cancelled = false;
async function fetchPage() {
async function fetchPage(id: string) {
try {
setError(undefined);
setLoading(true);

const newData = snapId
? ((await handleSnapRequest({
snapId,
origin: '',
handler: 'onSettingsPage',
request: {
jsonrpc: '2.0',
method: ' ',
},
})) as { id: string })
: undefined;
const newData = (await handleSnapRequest({
snapId: id,
origin: '',
handler: 'onSettingsPage',
request: {
jsonrpc: '2.0',
method: ' ',
},
})) as { id: string };
if (!cancelled) {
setData(newData);
forceUpdateMetamaskState(dispatch);
Expand All @@ -43,7 +41,7 @@ export function useSnapSettings({ snapId }: { snapId?: string }) {
}
}
}
fetchPage();
snapId && fetchPage(snapId);
return () => {
cancelled = true;
};
Expand Down

0 comments on commit 44fb407

Please sign in to comment.