Skip to content

Fix/normalized tables type bug #521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions apps/sim/lib/workflows/db-helpers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,12 +552,12 @@ describe('Database Helpers', () => {
workflowId: mockWorkflowId,
type: 'starter',
name: 'Start Block',
positionX: 100,
positionY: 100,
positionX: '100',
positionY: '100',
enabled: true,
horizontalHandles: true,
isWide: false,
height: 150,
height: '150',
parentId: null,
extent: null,
})
Expand Down
12 changes: 6 additions & 6 deletions apps/sim/lib/workflows/db-helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export async function loadWorkflowFromNormalizedTables(
type: block.type,
name: block.name,
position: {
x: block.positionX,
y: block.positionY,
x: Number(block.positionX),
y: Number(block.positionY),
},
enabled: block.enabled,
horizontalHandles: block.horizontalHandles,
isWide: block.isWide,
height: block.height,
height: Number(block.height),
subBlocks: block.subBlocks || {},
outputs: block.outputs || {},
data: block.data || {},
Expand Down Expand Up @@ -131,12 +131,12 @@ export async function saveWorkflowToNormalizedTables(
workflowId: workflowId,
type: block.type,
name: block.name || '',
positionX: block.position?.x || 0,
positionY: block.position?.y || 0,
positionX: String(block.position?.x || 0),
positionY: String(block.position?.y || 0),
Comment on lines +134 to +135
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Position values should be rounded before String conversion to prevent floating point precision issues

enabled: block.enabled ?? true,
horizontalHandles: block.horizontalHandles ?? true,
isWide: block.isWide ?? false,
height: block.height || 0,
height: String(block.height || 0),
subBlocks: block.subBlocks || {},
outputs: block.outputs || {},
data: block.data || {},
Expand Down