Rename UI: superuser Key row and rename dialog for flows and dashboards (live plan with rewritten documents, counts, refusals and warnings, typed confirmation, what the drain waits for and calling it off); applyRename and the socket's renamed remap the live store and refetch at unchanged URLs, editors whose document moved reload so neither undo nor a queued save restores old bindings, a reconnect checks again and its snapshot replaces values; a retry toast for the rename's 503s, autosaves send themselves again; dashboard saves are based on their own versions only; Playwright rename spec, liveStore check, editor and dashboard docs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
import { createFileRoute } from "@tanstack/react-router"
|
||||
import { useCallback, useState } from "react"
|
||||
|
||||
import { DashboardEditor } from "@/components/Dashboard/DashboardEditor"
|
||||
import type { Dashboard } from "@/components/Dashboard/DashboardView"
|
||||
@@ -25,6 +26,10 @@ function DashboardRoute() {
|
||||
// The working copy: an edit is the editor's until it is published, so what
|
||||
// a wall panel is showing right now stays untouched by this session.
|
||||
const { data: dashboard } = useQuery(dashboardQueryOptions(id, true))
|
||||
// Bumped when the editor has to take the server's document over its own,
|
||||
// as after a rename: its draft is state seeded on mount.
|
||||
const [epoch, setEpoch] = useState(0)
|
||||
const reload = useCallback(() => setEpoch((n) => n + 1), [])
|
||||
|
||||
if (!dashboard) return null
|
||||
|
||||
@@ -34,9 +39,10 @@ function DashboardRoute() {
|
||||
<title>{`${dashboard.title || dashboard.name} - Fluksio`}</title>
|
||||
<DashboardEditor
|
||||
// Leaving edit mode drops the draft, so the session starts clean.
|
||||
key={`${id}:${edit ? "edit" : "view"}`}
|
||||
key={`${id}:${edit ? "edit" : "view"}:${epoch}`}
|
||||
dashboard={dashboard as Dashboard}
|
||||
edit={Boolean(edit)}
|
||||
onReload={reload}
|
||||
/>
|
||||
</>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user