Skip to content

Commit 1ccb3ce

Browse files
committed
SY-3833: Address review comments
- ZERO_LEGEND in client/schematic/client.ts: add px units to position so sticky.toCSS doesn't fall back to the percent path and render the legend at 5000%. - useLoadRemote in console/schematic/Schematic.tsx: include remoteCreated: true in the action payload so the sync component doesn't re-create an already-existing schematic on every server push. - Schematic.create call sites in services/ontology.tsx (×2), services/link.ts, workspace/services/ontology.tsx, and range/overview/Snapshots.tsx: pass remoteCreated: true when spreading a server Schematic to avoid the same redundant re-create.
1 parent 93662a3 commit 1ccb3ce

6 files changed

Lines changed: 7 additions & 6 deletions

File tree

client/ts/src/schematic/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class Client {
146146

147147
export const ZERO_LEGEND: Legend = {
148148
visible: true,
149-
position: { x: 50, y: 50 },
149+
position: { x: 50, y: 50, units: { x: "px", y: "px" } },
150150
colors: {},
151151
};
152152

console/src/range/overview/Snapshots.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ const SNAPSHOTS: Record<"schematic" | "task", SnapshotService> = {
5050
onClick: async ({ id: { key } }, { client, placeLayout }) => {
5151
if (client == null) throw new DisconnectedError();
5252
const s = await client.schematics.retrieve({ key });
53-
placeLayout(create({ ...s }));
53+
placeLayout(create({ ...s, remoteCreated: true }));
5454
},
5555
onDelete: async ({ id: { key } }, { client }) => {
5656
if (client == null) throw new DisconnectedError();

console/src/schematic/Schematic.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ const useLoadRemote = createLoadRemote<schematic.Schematic>({
467467
useRetrieve: Base.useRetrieveObservable,
468468
targetVersion: ZERO_STATE.version,
469469
useSelectVersion,
470-
actionCreator: (v) => internalCreate({ ...ZERO_STATE, ...v }),
470+
actionCreator: (v) => internalCreate({ ...ZERO_STATE, ...v, remoteCreated: true }),
471471
});
472472

473473
export const Schematic: Layout.Renderer = ({ layoutKey, ...rest }) => {

console/src/schematic/services/link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,5 @@ import { Schematic } from "@/schematic";
1212

1313
export const handleLink: Link.Handler = async ({ client, key, placeLayout }) => {
1414
const schematic = await client.schematics.retrieve({ key });
15-
placeLayout(Schematic.create({ ...schematic, editable: false }));
15+
placeLayout(Schematic.create({ ...schematic, editable: false, remoteCreated: true }));
1616
};

console/src/schematic/services/ontology.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const loadSchematic = async (
181181
placeLayout: Layout.Placer,
182182
) => {
183183
const schematic = await client.schematics.retrieve({ key });
184-
placeLayout(Schematic.create({ ...schematic, editable: false }));
184+
placeLayout(Schematic.create({ ...schematic, editable: false, remoteCreated: true }));
185185
};
186186

187187
const handleSelect: Ontology.HandleSelect = ({
@@ -214,6 +214,7 @@ const handleMosaicDrop: Ontology.HandleMosaicDrop = ({
214214
...schematic,
215215
location: "mosaic",
216216
tab: { mosaicKey: nodeKey, location },
217+
remoteCreated: true,
217218
}),
218219
);
219220
}, "Failed to load schematic");

console/src/workspace/services/ontology.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const useCreateSchematic = ({
8888
afterSuccess: async ({ data }) => {
8989
const { workspace, ...schematic } = data;
9090
await maybeChangeWorkspace(workspace);
91-
placeLayout(Schematic.create({ ...schematic }));
91+
placeLayout(Schematic.create({ ...schematic, remoteCreated: true }));
9292
},
9393
});
9494
return useCallback(

0 commit comments

Comments
 (0)