Skip to content

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

fix: skip feature intro dialog if hash != null

thecodrr64b28806cb6d
diff --git a/apps/web/src/common/db.js b/apps/web/src/common/db.js
index d139dbed9..fbf32ea52 100644
--- a/apps/web/src/common/db.js
+++ b/apps/web/src/common/db.js
@@ -3,6 +3,7 @@ import EventSource from "eventsource";
import Config from "../utils/config";
import http from "notes-core/utils/http";
import { EV, EVENTS } from "notes-core/common";
+import { getCurrentHash, hashNavigate } from "../navigation";
/**
* @type {import("notes-core/api").default}
@@ -47,6 +48,7 @@ async function loadDefaultNotes(db) {
const notes = await http.get("/notes/index.json");
if (!notes) return;
let autoOpenId;
+ const hash = getCurrentHash().replaceAll("#", "");
for (let note of notes) {
const content = await http.get(note.webContent);
let id = await db.notes.add({
@@ -58,12 +60,10 @@ async function loadDefaultNotes(db) {
if (note.autoOpen) autoOpenId = id;
}
- if (autoOpenId) quickNavigate(`/notes/${autoOpenId}/edit`);
+ if (autoOpenId) {
+ hashNavigate(`/notes/${autoOpenId}/edit`);
+ if (hash) setTimeout(() => hashNavigate(hash), 100);
+ }
setAppHydrated();
EV.publish(EVENTS.appRefreshRequested);
}
-
-function quickNavigate(url) {
- window.history.replaceState(null, null, `#${url}`);
- dispatchEvent(new HashChangeEvent("hashchange"));
-}
diff --git a/apps/web/src/common/index.js b/apps/web/src/common/index.js
index 6fb77d2fb..a3df6e9e3 100644
--- a/apps/web/src/common/index.js
+++ b/apps/web/src/common/index.js
@@ -57,15 +57,13 @@ export const CREATE_BUTTON_MAP = {
export async function introduceFeatures() {
const hash = getCurrentHash().replace("#", "");
+ if (!!hash) return;
const features = ["monographs"];
- let reopen = false;
for (let feature of features) {
if (!Config.get(`feature:${feature}`)) {
- reopen = true;
await showFeatureDialog(feature);
}
}
- if (reopen && !!hash) hashNavigate(hash);
}
export const DEFAULT_CONTEXT = { colors: [], tags: [], notebook: {} };
diff --git a/apps/web/yarn.lock b/apps/web/yarn.lock
index 6d5640093..d2f1b962e 100644
--- a/apps/web/yarn.lock
+++ b/apps/web/yarn.lock
@@ -9192,7 +9192,7 @@ normalize-url@^4.1.0:
"notes-core@git+https://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:[email protected]/streetwriters/notesnook-core.git":
version "6.6.6"
- resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#4efda31a6c6d2e9f98554630b14abe4b3caea560"
+ resolved "git+https://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:[email protected]/streetwriters/notesnook-core.git#bb3aae0ab72b16664a0a9e1d92c259e83b9a5f5d"
dependencies:
"@stablelib/blake2s" "^1.0.1"
fast-sort "^2.0.1"