Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: notebook & topic navigation causing crash

thecodrr6792a15809e4
diff --git a/apps/web/src/components/notebook/index.js b/apps/web/src/components/notebook/index.js
index a65bc36bb..80f5d0841 100644
--- a/apps/web/src/components/notebook/index.js
+++ b/apps/web/src/components/notebook/index.js
@@ -63,11 +63,11 @@ class Notebook extends React.Component {
body={notebook.description}
subBody={
<Flex sx={{ marginBottom: 1, marginTop: 1 }}>
- {notebook.topics.slice(1, 4).map((topic, index) => (
+ {notebook.topics.slice(1, 4).map((topic) => (
<Flex
key={topic.id}
onClick={(e) => {
- onTopicClick(notebook, index + 1);
+ onTopicClick(notebook, topic.id);
e.stopPropagation();
}}
bg="primary"
diff --git a/apps/web/src/views/notebooks.js b/apps/web/src/views/notebooks.js
index 4a7c5d57e..443e4a9f2 100644
--- a/apps/web/src/views/notebooks.js
+++ b/apps/web/src/views/notebooks.js
@@ -25,7 +25,7 @@ const routes = {
),
"/:notebook/:topic": ({ notebook, topic }) => {
const nb = db.notebooks.notebook(notebook);
- const topicItem = nb.topics.all[topic];
+ const topicItem = nb.topics.topic(topic)._topic;
if (!topicItem) return navigate(`/notebooks/${nb.id}`);
return (