Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
client/collections/board: fix some issues
Adorian Doran4f52584825c7
diff --git a/apps/client/src/widgets/collections/board/column.tsx b/apps/client/src/widgets/collections/board/column.tsxindex 6fb45eee19..93af5edac1 100644--- a/apps/client/src/widgets/collections/board/column.tsx+++ b/apps/client/src/widgets/collections/board/column.tsx@@ -691,6 +691,20 @@ export function placeCard(card: HTMLElement, transform: string | null, atOnce: b});}+/** Puts every suppressed transition back at once, for a board leaving the page. */+export function settleCards() {+ if (restoring !== undefined) {+ cancelAnimationFrame(restoring);+ restoring = undefined;+ }++ for (const held of settling) {+ held.style.removeProperty("transition");+ }++ settling.clear();+}+/** The cards whose transition is suppressed, waiting for the frame that puts it back. */const settling = new Set<HTMLElement>();let restoring: number | undefined;diff --git a/apps/client/src/widgets/collections/board/index.tsx b/apps/client/src/widgets/collections/board/index.tsxindex 38cd4443d0..4f63954b2f 100644--- a/apps/client/src/widgets/collections/board/index.tsx+++ b/apps/client/src/widgets/collections/board/index.tsx@@ -45,7 +45,7 @@ import { forgetCardHeights } from "./drag_measure";import { BoardDropStateContext, DropStateStore } from "./drop_state";import BoardApi from "./api";import { DEFAULT_COLUMN_ICON, DEFAULT_GROUP_BY, getStatusDefinition, INBOX_COLUMN } from "./columns";-import Column, { EXPAND_MS, placeCard } from "./column";+import Column, { EXPAND_MS, placeCard, settleCards } from "./column";import { currentCardTemplate, DEFAULT_CARD_TEMPLATES } from "./card_templates";import ColumnLimitDialog from "./column_limit";import BoardProperties from "./properties";@@ -787,6 +787,15 @@ export default function BoardView({ note: parentNote, noteIds, viewConfig, saveC});}, []);+ // A board taken off the page leaves nothing of a gesture behind it to run in a later frame.+ useEffect(() => () => {+ if (stillFor.current !== undefined) {+ cancelAnimationFrame(stillFor.current);+ }++ settleCards();+ }, []);+const handleColumnDrop = useCallback((fromIndex: number, toIndex: number, animate = true) => {if (animate) {columnMovedUntil.current = Date.now() + FLIP_SETTLE_MS;