Skip to content

Commit

Permalink
Merge branch 'fix-back'
Browse files Browse the repository at this point in the history
  • Loading branch information
benma committed Nov 7, 2024
2 parents 6077981 + 272efa7 commit 48543f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- macOS: create a universal build that runs natively on arm64 and amd64
- Show fiat amount at the time of the transaction in transaction history
- Add BTC Direct private trading desk information
- Android: fix stuck back button after closing a dialog

# 4.45.0
- Bundle BitBox02 firmware version v9.21.0
Expand Down
9 changes: 5 additions & 4 deletions frontends/web/src/contexts/BackButtonContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type TProviderProps = {
}

export const BackButtonProvider = ({ children }: TProviderProps) => {
const [handlers, sethandlers] = useState<THandler[]>([]);
const [handlers, setHandlers] = useState<THandler[]>([]);
const { guideShown, toggleGuide } = useContext(AppContext);

const callTopHandler = useCallback(() => {
Expand All @@ -61,17 +61,18 @@ export const BackButtonProvider = ({ children }: TProviderProps) => {
}, [handlers, guideShown, toggleGuide]);

const pushHandler = useCallback((handler: THandler) => {
sethandlers((prevStack) => [...prevStack, handler]);
setHandlers((prevStack) => [...prevStack, handler]);
}, []);

const popHandler = useCallback((handler: THandler) => {
sethandlers((prevStack) => {
setHandlers((prevStack) => {
const index = prevStack.indexOf(handler);
if (index === -1) {
// Should never happen.
return prevStack;
}
return prevStack.slice(index, 1);
const res = prevStack.slice(0, index).concat(prevStack.slice(index + 1));
return res;
});
}, []);

Expand Down

0 comments on commit 48543f6

Please sign in to comment.