Fix some nasty bug
parent
b858917c98
commit
7f647758c2
|
@ -17,7 +17,7 @@ export class CompleterHook implements Hook<CompleterHookT> {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (const [functionName, functionDef] of Object.entries(
|
for (const [functionName, functionDef] of Object.entries(
|
||||||
plug.manifest.functions
|
plug.manifest.functions
|
||||||
)) {
|
)) {
|
||||||
if (functionDef.isCompleter) {
|
if (functionDef.isCompleter) {
|
||||||
completerPromises.push(plug.invoke(functionName, []));
|
completerPromises.push(plug.invoke(functionName, []));
|
||||||
|
@ -29,7 +29,7 @@ export class CompleterHook implements Hook<CompleterHookT> {
|
||||||
if (result) {
|
if (result) {
|
||||||
if (actualResult) {
|
if (actualResult) {
|
||||||
console.error(
|
console.error(
|
||||||
"Got completion results from multiple sources, cannot deal with that"
|
"Got completion results from multiple sources, cannot deal with that"
|
||||||
);
|
);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,22 +27,19 @@ export class PathPageNavigator {
|
||||||
subscribe(
|
subscribe(
|
||||||
pageLoadCallback: (pageName: string, pos: number) => Promise<void>
|
pageLoadCallback: (pageName: string, pos: number) => Promise<void>
|
||||||
): void {
|
): void {
|
||||||
const cb = (event?: PopStateEvent) => {
|
const cb = (event?: PopStateEvent) => {
|
||||||
const gotoPage = this.getCurrentPage();
|
const gotoPage = this.getCurrentPage();
|
||||||
if (!gotoPage) {
|
if (!gotoPage) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
safeRun(async () => {
|
||||||
|
await pageLoadCallback(this.getCurrentPage(), event && event.state.pos);
|
||||||
|
if (this.navigationResolve) {
|
||||||
|
this.navigationResolve();
|
||||||
}
|
}
|
||||||
safeRun(async () => {
|
});
|
||||||
await pageLoadCallback(
|
};
|
||||||
this.getCurrentPage(),
|
window.addEventListener("popstate", cb);
|
||||||
event && event.state.pos
|
|
||||||
);
|
|
||||||
if (this.navigationResolve) {
|
|
||||||
this.navigationResolve();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
window.addEventListener("popstate", cb);
|
|
||||||
cb();
|
cb();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue