mirror of
https://github.com/zadam/trilium.git
synced 2025-10-22 08:08:51 +02:00
fix(client): close button not working on first render
This commit is contained in:
parent
f068b335f5
commit
b9055c6810
@ -1,10 +1,10 @@
|
|||||||
import { useState } from "preact/hooks";
|
import { useEffect, useState } from "preact/hooks";
|
||||||
import { t } from "../../services/i18n";
|
import { t } from "../../services/i18n";
|
||||||
import ActionButton from "../react/ActionButton";
|
import ActionButton from "../react/ActionButton";
|
||||||
import { useNoteContext, useTriliumEvent } from "../react/hooks";
|
import { useNoteContext, useTriliumEvent } from "../react/hooks";
|
||||||
|
|
||||||
export default function ClosePaneButton() {
|
export default function ClosePaneButton() {
|
||||||
const { noteContext, parentComponent } = useNoteContext();
|
const { noteContext, ntxId, parentComponent } = useNoteContext();
|
||||||
const [ isEnabled, setIsEnabled ] = useState(false);
|
const [ isEnabled, setIsEnabled ] = useState(false);
|
||||||
|
|
||||||
function refresh() {
|
function refresh() {
|
||||||
@ -12,6 +12,7 @@ export default function ClosePaneButton() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useTriliumEvent("noteContextReorder", refresh);
|
useTriliumEvent("noteContextReorder", refresh);
|
||||||
|
useEffect(refresh, [ ntxId ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionButton
|
<ActionButton
|
||||||
|
Loading…
x
Reference in New Issue
Block a user