Skip to content

Build your personal knowledge base with Trilium Notes

client/right pane peek: optimize for no-backdrop effects/no-transitions performance mode

Adorian Doran7391dc1473b8
diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.css b/apps/client/src/widgets/sidebar/RightPanelContainer.css
index 41d870fb08..0b86a7cdd0 100644
--- a/apps/client/src/widgets/sidebar/RightPanelContainer.css
+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.css
@@ -185,4 +185,9 @@ body.experimental-feature-new-layout #right-pane {
.gutter-vertical + .card .card-header {
padding-top: 0;
}
+}
+
+/* Backdrop effects are disabled, so peek mode needs a solid background. */
+body.experimental-feature-new-layout.backdrop-effects-disabled #right-pane.right-pane-mode-peek {
+ background: var(--right-pane-background-color);
}
\ No newline at end of file
diff --git a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
index b2cb66ab1a..6146ebf505 100644
--- a/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
+++ b/apps/client/src/widgets/sidebar/RightPanelContainer.tsx
@@ -4,7 +4,7 @@ import "./RightPanelContainer.css";
import Split from "@triliumnext/split.js";
import clsx from "clsx";
import { VNode } from "preact";
-import { useEffect, useRef } from "preact/hooks";
+import { useLayoutEffect, useRef } from "preact/hooks";
import appContext from "../../components/app_context";
import { WidgetsByParent } from "../../services/bundle";
@@ -183,7 +183,12 @@ function useItems(rightPaneVisible: boolean, widgetsByParent: WidgetsByParent) {
}
function useSplit(mode: PaneMode) {
- useEffect(() => {
+ // A layout effect, not an effect: Preact flushes effects *after* paint, which would leave one
+ // frame where the host is already laid out (absolute and full-width in peek mode) but neither
+ // the spacer nor the pane has Split's inline width yet — the pane collapses to its content width
+ // against the host's left edge, then jumps right. The peek fade-in used to mask that frame; with
+ // motion disabled it's plainly visible.
+ useLayoutEffect(() => {
if (mode === "closed") return;
// We are intentionally omitting useTriliumOption to avoid re-render due to size change.