mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-03 12:41:45 +02:00
fix: favorites not opening
This commit is contained in:
@@ -45,11 +45,18 @@ export const routes = {
|
||||
...createRoute("notebooks", NotebooksContainer, {
|
||||
icon: Icon.Notebook,
|
||||
}),
|
||||
...createNormalRoute("favorites", Notes, Icon.StarOutline, {
|
||||
title: "Favorites",
|
||||
options: SelectionModeOptions.FavoritesOptions,
|
||||
context: { type: "favorites" },
|
||||
}),
|
||||
...createRoute(
|
||||
"favorites",
|
||||
Notes,
|
||||
{
|
||||
icon: Icon.StarOutline,
|
||||
title: "Favorites",
|
||||
options: SelectionModeOptions.FavoritesOptions,
|
||||
},
|
||||
{
|
||||
context: { type: "favorites" },
|
||||
}
|
||||
),
|
||||
...createNormalRoute("trash", Trash, Icon.Trash, {
|
||||
title: "Trash",
|
||||
options: SelectionModeOptions.TrashOptions,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import React from "react";
|
||||
import React, { useEffect } from "react";
|
||||
import Note from "../components/note";
|
||||
import ListContainer from "../components/list-container";
|
||||
import { useStore } from "../stores/editor-store";
|
||||
@@ -6,9 +6,17 @@ import { useStore as useNotesStore } from "../stores/note-store";
|
||||
import { DEFAULT_CONTEXT } from "../common";
|
||||
|
||||
function Notes(props) {
|
||||
const newSession = useStore(store => store.newSession);
|
||||
const context = useNotesStore(store => store.context);
|
||||
const newSession = useStore((store) => store.newSession);
|
||||
const context = useNotesStore((store) => store.context);
|
||||
const setContext = useNotesStore((store) => store.setContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (props.context) {
|
||||
setContext(props.context);
|
||||
}
|
||||
}, [props.context, setContext]);
|
||||
|
||||
if (!context) return null;
|
||||
return (
|
||||
<ListContainer
|
||||
type="notes"
|
||||
@@ -21,8 +29,8 @@ function Notes(props) {
|
||||
onClick: () =>
|
||||
newSession({
|
||||
...DEFAULT_CONTEXT,
|
||||
...props.context
|
||||
})
|
||||
...props.context,
|
||||
}),
|
||||
}}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user