Workflow UI flickers when updating the trigger step
Description
Generated from note: Reproduction
Setting the trigger makes the header actions and the trigger node flicker
https://github.com/user-attachments/assets/966eed8a-17bc-41d6-893b-c2397c463176
Updating the trigger's type makes the side panel and the header actions flicker
https://github.com/user-attachments/assets/27107c9c-a769-4463-8c07-fd8a7c61215d
Created by:
I dived in the issue
When we change a workflow trigger to a manual trigger with no record, we perform an updateOneRecord, which first updates the workflow record in the Apollo cache. It also launches an HTTP request.
The side panel actions are re-rendered, and as the Test action's shouldBeRegistered function now returns true, we render TestWorkflowSingleRecordAction.
This component calls the useWorkflowWithCurrentVersion hook, which retrieves the workflow data. It launches a findOne query.
We end up with the update request and a findOne request launched almost simultaneously (second video).
If the findOne response arrives before the updateOne response, the UI will shake because the findOne will return old data, not yet updated.
https://github.com/user-attachments/assets/1f5e25e4-8130-422a-a378-7030d7b47569
https://github.com/user-attachments/assets/9151dcb4-aa93-4332-8263-de49434c867e
https://github.com/user-attachments/assets/4df01b23-554c-451d-9cd9-a7b4bb641d17
Could still reproduce indeed!