Repository navigation
fix(shell): keep parentAlertsAdd stable across host prop updates - #968
Open
HendrikThePendric wants to merge 1 commit into
Open
HendrikThePendric wants to merge 1 commit into
HendrikThePendric wants to merge 1 commit into
Conversation
receivePropsFromParent stored a new alertsAdd wrapper on every message from the host, and post-robot gives a new proxy on every message too. So every prop change on the host gave AppAdapter a new parentAlertsAdd, which changed the identity of useAlert's `show` inside plugins. Keep the latest alertsAdd in a ref and pass one stable function that calls it and returns its result. Add tests that use the real post-robot, with the test acting as the host window, and mock @dhis2/app-adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
HendrikThePendric
force-pushed
the
fix/stable-parent-alerts-add
branch
from
November 10, 2026 10:40
393f8db to
b07861c
Compare
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Inside a plugin,
PluginLoaderpassedAppAdaptera newparentAlertsAddevery time the host updated the plugin's props. That changed the identity of app-runtime'suseAlert().show, so plugin effects and callbacks that depend onshowre-ran on every host update.PluginLoadernow keeps the latestalertsAddfrom the host in a ref and passes one function that never changes. That function calls the latestalertsAddand returns its result.Adds
PluginLoadertests that use the realpost-robot, with the test acting as the host window. jsdom'spostMessageis patched to setevent.sourceandevent.origin, which post-robot needs.@dhis2/app-adapteris mocked.Possible follow-ups:
onPluginError,clearPluginError,resizePluginHeightandresizePluginWidthare also replaced with new functions on every host message. For the resize callbacks, this recreates theResizeObservereach time.🤖 Generated with Claude Code