-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: trigger props resend when iframe src changes [LIBS-488] #1344
Conversation
|
||
const [inErrorState, setInErrorState] = useState<boolean>(false) | ||
|
||
useEffect(() => { | ||
setCommunicationReceived(false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the essential refinement of this ticket...whenever the pluginEntryPoint
changes now, the communicationReceived
is set to false to note that communication has been lost.
The communicationReceived
toggling to false will then trigger a resending of the props to the plugin.
// if communicationReceived switches from false to true, the props have been sent | ||
const prevCommunication = prevCommunicationReceived | ||
setPrevCommunicationReceived(communicationReceived) | ||
if (prevCommunication === false && communicationReceived === true) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is done so that when communicationReceived toggles from false to true (after successful send of props), the props are not sent an additional time
out of curiosity, do we have a specific use-case here, where we need to dynamically set the source of the plugin? or is this for development mode? I am also still unclear on why using the ref was not possible? Maybe needs expanding on how it affects the error boundary.. also that comment could be in the code, in case someone else comes and wonder why we didn't use |
Yeah. This situation occurs in the dashboard app because users can toggle between (for example) chart or map view of a visualization, which requires different plugin sources.
I think the proposal was for recording whether communication was received with a ref, and currently I want the component to rerender (and have the useEffect be triggered) when communication received goes from true to false (this is being used to let user "try again" from an error state and indicate to the app that it needs to resend props to plugin). This could be refactored if it's confusing to use it for this purpose. |
# [3.10.0-alpha.5](v3.10.0-alpha.4...v3.10.0-alpha.5) (2023-09-28) ### Bug Fixes * merge issues ([496472a](496472a)) * reset communication on either pluginSource or pluginShortName change ([3fdae5b](3fdae5b)) * trigger props resend when iframe src changes [LIBS-488] ([f4a6680](f4a6680)) * trigger props resend when iframe src changes [LIBS-488] [#1344](#1344) ([cea7600](cea7600))
🎉 This PR is included in version 3.10.0-alpha.5 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
# [3.11.0-alpha.1](v3.10.1...v3.11.0-alpha.1) (2023-12-21) ### Bug Fixes * add back plugin service dependency [LIBS-583] ([ca10691](ca10691)) * add back plugin service dependency [LIBS-583] ([6d43ae3](6d43ae3)) * add documentation, clean up ([c537590](c537590)) * add in plugin service in runtime package ([#1343](#1343)) ([ed06a9f](ed06a9f)) * add width to plugin documentation [LIBS-487] ([b2c6273](b2c6273)) * check memomized props for postMessage communication [LIBS-514] ([b1a3a0a](b1a3a0a)) * clean up ([e53ecbd](e53ecbd)) * clean up, add useless test ([b14952b](b14952b)) * custom error handling ([c72fc6e](c72fc6e)) * dependency array ([03ce64f](03ce64f)) * dependency resolution ([2480c1c](2480c1c)) * merge issues ([496472a](496472a)) * move eslint disable line ([48912d7](48912d7)) * plugin experimental docs ([be215b2](be215b2)) * prevent sending updated props to plugin when props do not change [LIBS-514] ([86c6f75](86c6f75)) * reset communication on either pluginSource or pluginShortName change ([3fdae5b](3fdae5b)) * temporarily disable failing test ([6664199](6664199)) * trigger props resend when iframe src changes [LIBS-488] ([f4a6680](f4a6680)) * trigger props resend when iframe src changes [LIBS-488] [#1344](#1344) ([cea7600](cea7600)) * type error ([9c17206](9c17206)) * update alpha branch [skip release] ([ccb793c](ccb793c)) * working autorsize width ([2991045](2991045)) ### Features * add autoresizing for height ([dbb6e26](dbb6e26)) * experimental plugin release ([f5cca86](f5cca86)) * ideas for plugin wrappers [LIBS-397] ([be38607](be38607)) * implement plugin wrappers (alpha) ([#1332](#1332)) ([56a9a3f](56a9a3f)) * plugin experimental export ([25f02a6](25f02a6)) * plugin wrappers, errors + alerts ([bda6a43](bda6a43)) * update plugin wrappers ([30c963c](30c963c))
🎉 This PR is included in version 3.11.0-alpha.1 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Implements LIBS-488
Key features
Description
This PR makes post-robot communication reinitialize when the iframe (plugin) src is changed.
Checklist
Known issues
Screenshots
For example (observe that the plugin src changes, but the passed property (name: Tom Wakiki) remains updated (evidence that the post-robot communication is behaving as appropriate)