Skip to content

Remove broken total count from workflow version#20324

Open
thomtrp wants to merge 2 commits intomainfrom
tt-fix-form-re-opening
Open

Remove broken total count from workflow version#20324
thomtrp wants to merge 2 commits intomainfrom
tt-fix-form-re-opening

Conversation

@thomtrp
Copy link
Copy Markdown
Contributor

@thomtrp thomtrp commented May 6, 2026

Problem

Opening a workflow run with a form step in the side panel, closing the form and reopening it crashes the app: <SidePanelWorkflowStepInfo> blows up on workflow.versions.find because versions is null in the Apollo cache.

Root cause

useWorkflowVersion was selecting:

workflow: { id, name, statuses, versions: { totalCount: true } }

Twenty's GraphQL field generator doesn't support connection-level scalars — { totalCount: true } is interpreted as fields on the inner WorkflowVersion node, gets filtered out, and the query collapses to:
versions { edges { node { __typename } } }
The server returns versions: null for that empty-node selection.

Why now
The selection has always been wrong, but two recent changes made it consistently surface:

Apollo Client v4 upgrade (#18584): stricter normalized writes, null always wins.
#20242: WorkflowRunSSESubscribeEffect in the form filler keeps SSE flowing, which re-fires useWorkflowVersion more often, making the bad query consistently the last writer.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Copy link
Copy Markdown
Member

@Weiko Weiko left a comment

Choose a reason for hiding this comment

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

If not used then LGTM 👍

@thomtrp thomtrp enabled auto-merge May 6, 2026 14:23
@thomtrp thomtrp added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
@thomtrp thomtrp added this pull request to the merge queue May 6, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants