mirror of
https://github.com/waku-org/js-waku-lab.git
synced 2025-01-12 10:04:07 +00:00
chore(flush-notes): fix build
This commit is contained in:
parent
d05bbd6cb8
commit
ad08accafc
15
examples/experimental/web-chat/package-lock.json
generated
15
examples/experimental/web-chat/package-lock.json
generated
@ -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": {
|
||||
|
@ -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 />;
|
||||
|
@ -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 };
|
||||
};
|
||||
|
@ -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> {
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user