Skip to content

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

fix: crash sometimes when navigating to color

thecodrrce8bd3cf4159
diff --git a/apps/web/src/navigation/routes.js b/apps/web/src/navigation/routes.js
index a4a57007c..ebc5c2cdc 100644
--- a/apps/web/src/navigation/routes.js
+++ b/apps/web/src/navigation/routes.js
@@ -83,13 +83,18 @@ const routes = {
/>
);
},
- "/colors/:color": ({ color }) => (
- <RouteContainer
- type="notes"
- title={toTitleCase(db.colors.tag(color).title)}
- route={<Notes context={{ type: "color", value: color }} />}
- />
- ),
+ "/colors/:color": ({ color }) => {
+ const colorItem = db.colors.tag(color);
+ if (!colorItem) return navigate("/");
+ const { title } = colorItem;
+ return (
+ <RouteContainer
+ type="notes"
+ title={toTitleCase(title)}
+ route={<Notes context={{ type: "color", value: color }} />}
+ />
+ );
+ },
"/settings": () => <RouteContainer title="Settings" route={<Settings />} />,
"/search": () => (
<RouteContainer type="search" canGoBack title="Search" route={<Search />} />