maybe fix links in modals
Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
parent
0d42fe1c96
commit
c531c26078
1 changed files with 8 additions and 8 deletions
|
@ -105,8 +105,10 @@ const ModalRoot: React.FC<IModalRoot> = ({ children, onCancel, onClose, type })
|
||||||
|
|
||||||
const handleModalOpen = () => {
|
const handleModalOpen = () => {
|
||||||
modalHistoryKey.current = Date.now();
|
modalHistoryKey.current = Date.now();
|
||||||
unlistenHistory.current = history.listen((_, action) => {
|
unlistenHistory.current = history.listen(({ state }, action) => {
|
||||||
if (action === 'POP') {
|
if (!(state as any)?.soapboxModalKey) {
|
||||||
|
onClose();
|
||||||
|
} else if (action === 'POP') {
|
||||||
handleOnClose();
|
handleOnClose();
|
||||||
|
|
||||||
if (onCancel) onCancel();
|
if (onCancel) onCancel();
|
||||||
|
@ -118,11 +120,9 @@ const ModalRoot: React.FC<IModalRoot> = ({ children, onCancel, onClose, type })
|
||||||
if (unlistenHistory.current) {
|
if (unlistenHistory.current) {
|
||||||
unlistenHistory.current();
|
unlistenHistory.current();
|
||||||
}
|
}
|
||||||
if (!['FAVOURITES', 'MENTIONS', 'REACTIONS', 'REBLOGS', 'MEDIA'].includes(type)) {
|
const { state } = history.location;
|
||||||
const { state } = history.location;
|
if (state && (state as any).soapboxModalKey === modalHistoryKey.current) {
|
||||||
if (state && (state as any).soapboxModalKey === modalHistoryKey.current) {
|
history.goBack();
|
||||||
history.goBack();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ const ModalRoot: React.FC<IModalRoot> = ({ children, onCancel, onClose, type })
|
||||||
|
|
||||||
ensureHistoryBuffer();
|
ensureHistoryBuffer();
|
||||||
}
|
}
|
||||||
});
|
}, [children]);
|
||||||
|
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
return (
|
return (
|
||||||
|
|
Loading…
Reference in a new issue