chore(flush-notes): fix build

This commit is contained in:
Danish Arora 2024-10-29 16:08:58 +05:30
parent d05bbd6cb8
commit ad08accafc
No known key found for this signature in database
GPG Key ID: 1C6EF37CDAE1426E
5 changed files with 16 additions and 23 deletions

View File

@ -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": {

View File

@ -19,7 +19,7 @@ const View = () => {
}
notes.readNote(id, key).then((note) => setNote(note || ""));
}, [id, key, setNote]);
}, [id, key, setNote, router]);
if (!note) {
return <Loading />;

View File

@ -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 };
};

View File

@ -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<NoteResult> {

View File

@ -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<void> {
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);