Skip to content

Conversation

@odeimaiz
Copy link
Member

@odeimaiz odeimaiz commented Jul 24, 2025

What do these changes do?

This PR changes the timing of when the PATCHES to the backend are triggered.

We currently, every 3", serialize and deep-compare the frontend's current study JSON state to the one in the backend (the frontend keeps a copy of it). This diff is curated and the backend updates its state. The drawbacks of this approach are that:

  • it's not very efficient because deep comparisons can be expensive (~50ms in our case)
  • unnecessary diffs even when there are no changes
  • it is not collaborative friendly

Now, and only when WEBSERVER_REALTIME_COLLABORATION is enabled, we move to an event-driven patching system, where we listen to changes in the study and trigger the patching process. For now, no changes in the patching process: we still compute the diff and send it to the backend. Since we don't want to overload the backend with patches that can happen in chain, there is a throttling mechanism that will wait 500ms and then patch. Even though the frontend still doesn't send the atomic patch data, it does generate the patch model proposed in here and we might eventually move there.

We listen to changes on

name
description
thumbnail
workbench
  {nodeId}
    key
    version
    label
    inputs
    inputNodes
    inputsRequired
    inputsUnits
    outputs // only file-picker and parameter
    bootOptions
    progress // only file-picker
ui
  workbench
    {nodeId}
      position
      marker
  slideshow
  currentNodeId // this is personal, so eventually this won't be patched or the backend won't broadcast it
  mode // this is personal, so eventually this won't be patched or the backend won't broadcast it
  annotations
    {annotationId}
      position
      attributes
      color
dev
templateType

Demos:

Changes: study.name, study.workbench.$nodeId.[label, inputNodes, bootOptions] and study.ui.workbench.$nodeId.position
EventDriven

Changes: study.workbench.$nodeId.inputs
EventDrivenInputs

Changes: Study.ui.workbench.$nodeId.marker and Study.ui.annotations/$annotationId
EventDrivenAnnotations

Related issue/s

How to test

Dev-ops

@odeimaiz odeimaiz self-assigned this Jul 24, 2025
@odeimaiz odeimaiz added t:enhancement Improvement or request on an existing feature a:frontend issue affecting the front-end (area group) labels Jul 24, 2025
@odeimaiz odeimaiz added this to the Engage milestone Jul 24, 2025
@odeimaiz odeimaiz added the 🤖-automerge marks PR as ready to be merged for Mergify label Jul 26, 2025
@odeimaiz
Copy link
Member Author

@mergify queue

@mergify
Copy link
Contributor

mergify bot commented Jul 26, 2025

queue

✅ The pull request has been merged automatically

The pull request has been merged automatically at 3ecd9de

@sonarqubecloud
Copy link

Copy link
Collaborator

@matusdrobuliak66 matusdrobuliak66 left a comment

Choose a reason for hiding this comment

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

🚀

@mergify mergify bot merged commit 3ecd9de into ITISFoundation:master Jul 27, 2025
111 of 113 checks passed
@odeimaiz odeimaiz deleted the feature/event-driven-patches branch August 5, 2025 07:17
@matusdrobuliak66 matusdrobuliak66 mentioned this pull request Aug 5, 2025
88 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🤖-automerge marks PR as ready to be merged for Mergify a:frontend issue affecting the front-end (area group) t:enhancement Improvement or request on an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants