Skip to content

fix: stabilize data engine context - #1445

Merged
KaiVandivier merged 2 commits into
masterfrom
fix/prevent-rebuilding-data-engine-plugin-context
Aug 23, 2026
Merged

fix: stabilize data engine context#1445
KaiVandivier merged 2 commits into
masterfrom
fix/prevent-rebuilding-data-engine-plugin-context

Conversation

@HendrikThePendric

@HendrikThePendric HendrikThePendric commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Implements N/A


Description

This is the problem I hit in the new event-visualizer-app:

  1. The dashboard sends a filter change. Our plugin gets new props over postMessage.
  2. PluginLoader calls setPropsFromParent. That re-renders the whole tree inside the iframe.
  3. DataProvider sits in that tree. Nothing above it is memoised, so it re-renders too.
  4. On every render, DataProvider runs new RestAPILink(config) and new DataEngine(link). So useDataEngine() hands out a different engine object than last render.

To avoid this, first we need to ensure config is as stable as possible, which we do by memoizing what we can in dhis2/app-platform#962. And with this stable config we can produce a stable context here.

While the changes in this PR rely on the fix in dhis2/app-platform#962, as well I wouldn't go as far as saying that these two PRs are fully interdependent. This code will run fine without the changes in app-platform. The issue won't be fixed, but it also won't be any worse than things currently are.

@sonarqubecloud

Copy link
Copy Markdown

@KaiVandivier KaiVandivier left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good 👏

@KaiVandivier
KaiVandivier merged commit 2337108 into master Aug 23, 2026
25 checks passed
@KaiVandivier
KaiVandivier deleted the fix/prevent-rebuilding-data-engine-plugin-context branch August 23, 2026 14:41
dhis2-bot added a commit that referenced this pull request Aug 23, 2026
## [3.17.4](v3.17.3...v3.17.4) (2026-08-23)

### Bug Fixes

* **data-service:** stabilize data engine context ([#1445](#1445)) ([2337108](2337108))
@dhis2-bot

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants