diff --git a/examples/experimental/web-chat/package-lock.json b/examples/experimental/web-chat/package-lock.json index 53ff3bc..1e2e61a 100644 --- a/examples/experimental/web-chat/package-lock.json +++ b/examples/experimental/web-chat/package-lock.json @@ -8438,9 +8438,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001605", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz", - "integrity": "sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ==", + "version": "1.0.30001674", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001674.tgz", + "integrity": "sha512-jOsKlZVRnzfhLojb+Ykb+gyUSp9Xb57So+fAiFlLzzTKpqg8xxSav0e40c8/4F/v9N8QSvrRRaLeVzQbLqomYw==", "dev": true, "funding": [ { @@ -8455,7 +8455,8 @@ "type": "github", "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "CC-BY-4.0" }, "node_modules/case-sensitive-paths-webpack-plugin": { "version": "2.4.0", @@ -30061,9 +30062,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001605", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001605.tgz", - "integrity": "sha512-nXwGlFWo34uliI9z3n6Qc0wZaf7zaZWA1CPZ169La5mV3I/gem7bst0vr5XQH5TJXZIMfDeZyOrZnSlVzKxxHQ==", + "version": "1.0.30001674", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001674.tgz", + "integrity": "sha512-jOsKlZVRnzfhLojb+Ykb+gyUSp9Xb57So+fAiFlLzzTKpqg8xxSav0e40c8/4F/v9N8QSvrRRaLeVzQbLqomYw==", "dev": true }, "case-sensitive-paths-webpack-plugin": { diff --git a/examples/flush-notes/src/app/view/page.tsx b/examples/flush-notes/src/app/view/page.tsx index f454ba1..c58b0ba 100644 --- a/examples/flush-notes/src/app/view/page.tsx +++ b/examples/flush-notes/src/app/view/page.tsx @@ -19,7 +19,7 @@ const View = () => { } notes.readNote(id, key).then((note) => setNote(note || "")); - }, [id, key, setNote]); + }, [id, key, setNote, router]); if (!note) { return ; diff --git a/examples/flush-notes/src/hooks/useNoteURL.ts b/examples/flush-notes/src/hooks/useNoteURL.ts index 7a2a3ae..1c7a27e 100644 --- a/examples/flush-notes/src/hooks/useNoteURL.ts +++ b/examples/flush-notes/src/hooks/useNoteURL.ts @@ -1,15 +1,9 @@ "use client"; -import { usePathname, useSearchParams } from "next/navigation"; export const useNoteURL = (): { id: string; key: string } => { - const pathname = usePathname(); - const params = useSearchParams(); - - const segments = pathname.split("/"); - const viewIndex = segments.indexOf("view"); - const key = params.get("key")!; - - const id = segments[viewIndex + 1]; + const searchParams = new URLSearchParams(window?.location?.search || ''); + const id = searchParams.get('id') || ''; + const key = searchParams.get('key') || ''; return { key, id }; }; diff --git a/examples/flush-notes/src/services/notes.ts b/examples/flush-notes/src/services/notes.ts index 7a68f2e..7d711c7 100644 --- a/examples/flush-notes/src/services/notes.ts +++ b/examples/flush-notes/src/services/notes.ts @@ -27,6 +27,7 @@ export class Notes { private messages: DecodedMessage[] = []; private subscription: undefined | Unsubscribe; + // eslint-disable-next-line @typescript-eslint/no-empty-function constructor() {} public async createNote(content: string): Promise { diff --git a/examples/flush-notes/src/services/waku.ts b/examples/flush-notes/src/services/waku.ts index 8f01aaf..0beba40 100644 --- a/examples/flush-notes/src/services/waku.ts +++ b/examples/flush-notes/src/services/waku.ts @@ -24,14 +24,11 @@ export enum WakuEvents { export class Waku { private node: undefined | LightNode; - private emitter = new EventTarget(); - private initialized: boolean = false; - private initializing: boolean = false; + private initialized = false; + private initializing = false; public pubsubTopic?: string; - constructor() {} - public async init(): Promise { if (this.initialized || this.initializing) { return; @@ -108,7 +105,7 @@ export class Waku { } private ensureWakuInitialized() { - if (!waku.initialized) { + if (!this.initialized) { const message = "Waku is not initialized."; console.log(message); throw Error(message);