mirror of
https://github.com/Sonny93/my-links.git
synced 2025-12-09 23:15:36 +00:00
fix: page transition played when switching collection after soft navigation
This commit is contained in:
@@ -33,18 +33,23 @@ export default function BaseLayout({ children }: { children: ReactNode }) {
|
||||
const currentLocation = new URL(window.location.href);
|
||||
flipClass(TRANSITION_IN_CLASS, TRANSITION_OUT_CLASS);
|
||||
|
||||
router.on(
|
||||
const removeStartEventListener = router.on(
|
||||
'start',
|
||||
(event) =>
|
||||
canTransition(currentLocation, event.detail.visit.url) &&
|
||||
flipClass(TRANSITION_OUT_CLASS, TRANSITION_IN_CLASS)
|
||||
);
|
||||
router.on(
|
||||
const removefinishEventListener = router.on(
|
||||
'finish',
|
||||
(event) =>
|
||||
canTransition(currentLocation, event.detail.visit.url) &&
|
||||
flipClass(TRANSITION_IN_CLASS, TRANSITION_OUT_CLASS)
|
||||
);
|
||||
|
||||
return () => {
|
||||
removeStartEventListener();
|
||||
removefinishEventListener();
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user