-
Notifications
You must be signed in to change notification settings - Fork 752
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
OnLoad fires before api is consumed from ref #100
Comments
I had a similar issue when using
IMHO, its much faster to do 2. Good luck! |
I'm having this issue as well, it looks like the component isn't really designed to work with functional components, which is a shame |
how about this (working) pattern. Ignore using onLoad completely and just rely on the DOM object status via a ref, waiting until it exists and has an 'editor' object attached. Note some of the coding was required to allow the component to be remounted in the same component tree:
In my example I'm passing in a getter/setter function for the editor dom object, as opposed to a local ref.
This means, when my controlling component wants to save, it can just call for the current design state via that ref which it owns:
|
You can change the loaded event handler to;
this should solve the problem |
I've actually just implemented this even more tidily. Also uses the 'design:updated' event to fire an 'onChange' event from the component which can be used to track change / store changes to template.
|
I'm trying to set merge tags
onLoad
and it works when the componenet loads for the first time inside a popup. However, if I close the popup and reopen it, theonLoad
fires before the api can be set locally via ref, thus leading to it beingundefined
.I have a working example showing what the issue is: https://codesandbox.io/s/react-modal-rjzgc
The text was updated successfully, but these errors were encountered: