Skip to content

Commit 771e5a8

Browse files
committed
Fix must-click-twice bug in mobile (switch list from hash to query)
1 parent ca1d7f7 commit 771e5a8

3 files changed

Lines changed: 7 additions & 16 deletions

File tree

components/JottingsControls/jottingsControl.js

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,18 +29,9 @@ export default function JottingsControl(props) {
2929
}, [width]);
3030

3131
useEffect(() => {
32-
const onHashChangeStart = (url) => {
33-
const newHash = url.split('#')[1];
34-
console.log(`Path changing to ${newHash}`);
35-
setActiveList(newHash || 'labels');
36-
};
37-
38-
router.events.on("hashChangeStart", onHashChangeStart);
39-
40-
return () => {
41-
router.events.off("hashChangeStart", onHashChangeStart);
42-
};
43-
}, [router.events]);
32+
setActiveList(router.query.list || 'labels');
33+
34+
}, [router.query]);
4435

4536
const getJotsToShow = (response, jotType) => {
4637
if (

components/JottingsControls/noteControl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export default function NoteControl({ notes }) {
2828
urlService.setQueryToJottingInfo("note");
2929
}, [notes]);
3030

31-
if (showNote && router.query.type == "note") {
31+
if (showNote) {
3232
return (
3333
<article ref={showShareMenu ? ref : null} className={`${jottingsControl.fullJotting} ${jottingsControl.noteControl}`}>
3434
<div

components/MobileNav/MobileNav.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Link from "next/link";
44
export default function MobileNav() {
55
return (
66
<nav className={mobileNav.mobileNav}>
7-
<Link href="#labels">Labels</Link>
8-
<Link href="#notes">Notes</Link>
9-
<Link href="#tasks">Tasks</Link>
7+
<Link href="?list=labels">Labels</Link>
8+
<Link href="?list=notes">Notes</Link>
9+
<Link href="?list=tasks">Tasks</Link>
1010
</nav>
1111
);
1212
}

0 commit comments

Comments
 (0)