swarm-ui: give the new-flow draft a route no flow id can take, and drop the dead hit-count rule
/notifications/new could be a saved flow's own page, so the draft now opens at /notifications/draft/new, which has a segment more than any flow's route. The placeholder id no longer needs reserving. The .notify-node-hits rule styled the removed tree rows; nothing renders it.
This commit is contained in:
parent
d0a55502a8
commit
6e7b5f84e9
7 changed files with 21 additions and 28 deletions
|
|
@ -3,7 +3,7 @@
|
|||
// document back at the revision it was read. Edits stay in a draft until
|
||||
// then, so a half-built flow never reaches the router.
|
||||
//
|
||||
// The same page makes a flow: `/notifications/new` is an empty draft, and
|
||||
// The same page makes a flow: `NEW_FLOW_PATH` is an empty draft, and
|
||||
// `?from=<id>` a copy of a flow to start from. Nothing exists until Save, which
|
||||
// gives the flow an id made of its name.
|
||||
//
|
||||
|
|
@ -33,7 +33,6 @@ import {
|
|||
isDirty,
|
||||
limitsOf,
|
||||
moveAmongSiblings,
|
||||
NEW_FLOW_ID,
|
||||
paletteKinds,
|
||||
removeNode,
|
||||
reparent,
|
||||
|
|
@ -59,9 +58,12 @@ function rootOf(flow: Flow): string | null {
|
|||
|
||||
export function FlowEditorPage({
|
||||
params,
|
||||
}: RouteComponentProps<{ flowId: string }>) {
|
||||
isNew = false,
|
||||
}: RouteComponentProps<{ flowId: string }> & {
|
||||
// The page for a flow not saved yet, which has no flow id.
|
||||
isNew?: boolean;
|
||||
}) {
|
||||
const flowId = decodeURIComponent(params.flowId);
|
||||
const isNew = flowId === NEW_FLOW_ID;
|
||||
const from = new URLSearchParams(useSearch()).get("from");
|
||||
const [, navigate] = useLocation();
|
||||
const [view, setView] = useState<FlowsView | null>(null);
|
||||
|
|
|
|||
Loading…
Reference in a new issue