Skip to content

Commit 409b6ef

Browse files
committed
fix(deps): preserve runtime and canvas behavior
1 parent f59c69f commit 409b6ef

81 files changed

Lines changed: 1183 additions & 787 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ Dockerfile*
3232

3333
# Build artifacts and caches
3434
.next
35+
**/.next
3536
.turbo
37+
**/.turbo
3638
.cache
3739
dist
3840
build

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ jobs:
266266
echo "ERROR: DEV_TRIGGER_ACCESS_TOKEN and TRIGGER_PROJECT_ID repo secrets must both be set" >&2
267267
exit 1
268268
fi
269-
bunx trigger.dev@4.5.7 deploy --env preview --branch dev-sim
269+
bunx trigger.dev@4.5.12 deploy --env preview --branch dev-sim
270270
271271
# Main/staging: build AMD64 images and push sha-tagged images to ECR + GHCR.
272272
# Runs in parallel with tests — only immutable sha tags are pushed here, and

apps/desktop/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
"@sim/tsconfig": "workspace:*",
5151
"@types/micromatch": "4.0.10",
5252
"@types/node": "24.2.1",
53-
"electron": "43.4.1",
53+
"electron": "43.5.0",
5454
"electron-builder": "26.15.3",
5555
"esbuild": "0.28.1",
5656
"jsdom": "^26.0.0",

apps/docs/components/workflow-preview/block-preview.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
'use client'
22

33
import { useMemo } from 'react'
4-
import { CANVAS_Z_INDEX_MODE } from '@sim/workflow-renderer'
4+
import { CANVAS_Z_INDEX_MODE, useCanvasColorMode } from '@sim/workflow-renderer'
55
import { type NodeTypes, ReactFlow, ReactFlowProvider } from '@xyflow/react'
66
import { domAnimation, LazyMotion } from 'framer-motion'
77
import '@xyflow/react/dist/style.css'
88
import { BLOCK_DISPLAY_WORKFLOWS } from '@/components/workflow-preview/block-display-workflows'
99
import { DocsBlockNode } from '@/components/workflow-preview/docs-block-node'
10-
import { usePreviewColorMode } from '@/components/workflow-preview/use-preview-color-mode'
10+
import { FitViewAfterInit } from '@/components/workflow-preview/fit-view-after-init'
1111
import { toReactFlowElements } from '@/components/workflow-preview/workflow-data'
1212

1313
/** The hero mounts the same node type the canvas uses, so it can never drift. */
@@ -30,7 +30,7 @@ interface BlockPreviewProps {
3030
* `block-display-workflows.ts`.
3131
*/
3232
export function BlockPreview({ type }: BlockPreviewProps) {
33-
const colorMode = usePreviewColorMode()
33+
const colorMode = useCanvasColorMode()
3434
const workflow = BLOCK_DISPLAY_WORKFLOWS[type]
3535

3636
const elements = useMemo(() => (workflow ? toReactFlowElements(workflow) : null), [workflow])
@@ -51,8 +51,6 @@ export function BlockPreview({ type }: BlockPreviewProps) {
5151
edges={elements.edges}
5252
nodeTypes={NODE_TYPES}
5353
proOptions={PRO_OPTIONS}
54-
fitView
55-
fitViewOptions={FIT_VIEW_OPTIONS}
5654
minZoom={0.2}
5755
maxZoom={1.3}
5856
nodesDraggable={false}
@@ -64,8 +62,9 @@ export function BlockPreview({ type }: BlockPreviewProps) {
6462
panOnDrag={false}
6563
panOnScroll={false}
6664
preventScrolling={false}
67-
className='h-full w-full'
65+
className='h-full w-full [--xy-background-color:var(--bg)]'
6866
/>
67+
<FitViewAfterInit options={FIT_VIEW_OPTIONS} />
6968
</ReactFlowProvider>
7069
</LazyMotion>
7170
</div>
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use client'
2+
3+
import { useEffect } from 'react'
4+
import { type FitViewOptions, useNodesInitialized, useReactFlow } from '@xyflow/react'
5+
6+
interface FitViewAfterInitProps {
7+
options: FitViewOptions
8+
}
9+
10+
/** Fits a v12 canvas only after every node has real measured dimensions. */
11+
export function FitViewAfterInit({ options }: FitViewAfterInitProps) {
12+
const nodesInitialized = useNodesInitialized()
13+
const { fitView } = useReactFlow()
14+
15+
useEffect(() => {
16+
if (nodesInitialized) void fitView(options)
17+
}, [fitView, nodesInitialized, options])
18+
19+
return null
20+
}

apps/docs/components/workflow-preview/use-preview-color-mode.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

apps/docs/components/workflow-preview/workflow-preview.tsx

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { useCallback, useEffect, useMemo, useRef, useState } from 'react'
44
import { Expand, X } from '@sim/emcn/icons'
5-
import { CANVAS_Z_INDEX_MODE } from '@sim/workflow-renderer'
5+
import { CANVAS_Z_INDEX_MODE, useCanvasColorMode } from '@sim/workflow-renderer'
66
import {
77
applyEdgeChanges,
88
applyNodeChanges,
@@ -21,7 +21,7 @@ import { BLOCK_DISPLAY_WORKFLOWS } from '@/components/workflow-preview/block-dis
2121
import { BlockInspector } from '@/components/workflow-preview/block-inspector'
2222
import { DocsBlockNode } from '@/components/workflow-preview/docs-block-node'
2323
import { DocsContainerNode } from '@/components/workflow-preview/docs-container-node'
24-
import { usePreviewColorMode } from '@/components/workflow-preview/use-preview-color-mode'
24+
import { FitViewAfterInit } from '@/components/workflow-preview/fit-view-after-init'
2525
import {
2626
EASE_OUT,
2727
type PreviewBlock,
@@ -179,7 +179,8 @@ function PreviewFlow({
179179
[workflow, animate, highlightBlock, highlightEdge, selectedBlock]
180180
)
181181

182-
const colorMode = usePreviewColorMode()
182+
const colorMode = useCanvasColorMode()
183+
183184
const [nodes, setNodes] = useState<PreviewNode[]>(initialNodes)
184185
const [edges, setEdges] = useState<PreviewFlowEdge[]>(initialEdges)
185186

@@ -208,34 +209,35 @@ function PreviewFlow({
208209
)
209210

210211
return (
211-
<ReactFlow<PreviewNode, PreviewFlowEdge>
212-
colorMode={colorMode}
213-
zIndexMode={CANVAS_Z_INDEX_MODE}
214-
nodes={nodes}
215-
edges={edges}
216-
onNodesChange={onNodesChange}
217-
onEdgesChange={onEdgesChange}
218-
onNodeClick={onNodeClick ? (_, node) => onNodeClick(node.id) : undefined}
219-
onPaneClick={onPaneClick}
220-
nodeTypes={NODE_TYPES}
221-
edgeTypes={EDGE_TYPES}
222-
defaultEdgeOptions={{ type: 'previewEdge' }}
223-
elementsSelectable={false}
224-
nodesDraggable
225-
nodesConnectable={false}
226-
zoomOnScroll={interactive}
227-
zoomOnDoubleClick={interactive}
228-
panOnScroll={false}
229-
zoomOnPinch
230-
panOnDrag
231-
preventScrolling={interactive}
232-
autoPanOnNodeDrag={false}
233-
proOptions={PRO_OPTIONS}
234-
minZoom={0.1}
235-
fitView
236-
fitViewOptions={interactive ? LIGHTBOX_FIT_VIEW_OPTIONS : FIT_VIEW_OPTIONS}
237-
className='h-full w-full'
238-
/>
212+
<>
213+
<ReactFlow<PreviewNode, PreviewFlowEdge>
214+
colorMode={colorMode}
215+
zIndexMode={CANVAS_Z_INDEX_MODE}
216+
nodes={nodes}
217+
edges={edges}
218+
onNodesChange={onNodesChange}
219+
onEdgesChange={onEdgesChange}
220+
onNodeClick={onNodeClick ? (_, node) => onNodeClick(node.id) : undefined}
221+
onPaneClick={onPaneClick}
222+
nodeTypes={NODE_TYPES}
223+
edgeTypes={EDGE_TYPES}
224+
defaultEdgeOptions={{ type: 'previewEdge' }}
225+
elementsSelectable={false}
226+
nodesDraggable
227+
nodesConnectable={false}
228+
zoomOnScroll={interactive}
229+
zoomOnDoubleClick={interactive}
230+
panOnScroll={false}
231+
zoomOnPinch
232+
panOnDrag
233+
preventScrolling={interactive}
234+
autoPanOnNodeDrag={false}
235+
proOptions={PRO_OPTIONS}
236+
minZoom={0.1}
237+
className='h-full w-full [--xy-background-color:var(--bg)]'
238+
/>
239+
<FitViewAfterInit options={interactive ? LIGHTBOX_FIT_VIEW_OPTIONS : FIT_VIEW_OPTIONS} />
240+
</>
239241
)
240242
}
241243

apps/sim/app/(landing)/demo/components/demo-booking/demo-booking.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,20 @@ import { chipBorderShadowRing, cn } from '@sim/emcn'
55
import dynamic from 'next/dynamic'
66
import { preconnect } from 'react-dom'
77
import { DemoForm, type DemoLead } from '@/app/(landing)/demo/components/demo-form'
8-
import { CAL_ORIGIN } from '@/app/(landing)/demo/components/demo-scheduler/cal-config'
98
import { applyLegacyInertFallback } from '@/app/(landing)/demo/components/legacy-inert-fallback'
109

1110
const importScheduler = () => import('@/app/(landing)/demo/components/demo-scheduler')
1211

1312
/**
1413
* Warm the entire booking path while the visitor fills the form: preconnect to
15-
* the configured Cal origin, then load the scheduler chunk and the
14+
* app.cal.com, then load the scheduler chunk, Cal.com's embed.js, and the
1615
* booker iframe assets (via the embed's `preload` instruction). Fired on first
1716
* form focus so nothing Cal.com-related competes with initial page load — the
1817
* connection handshake overlaps the chunk import, and it all finishes long
1918
* before the visitor submits.
2019
*/
2120
function preloadScheduler() {
22-
preconnect(CAL_ORIGIN)
21+
preconnect('https://app.cal.com')
2322
return importScheduler().then((m) => m.preloadCalEmbed())
2423
}
2524

apps/sim/app/(landing)/demo/components/demo-scheduler/cal-config.ts

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)