Skip to content
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

Updating mobiledoc property does not work #164

Open
sdhull opened this issue Dec 17, 2018 · 2 comments
Open

Updating mobiledoc property does not work #164

sdhull opened this issue Dec 17, 2018 · 2 comments

Comments

@sdhull
Copy link

sdhull commented Dec 17, 2018

The {{mobiledoc-editor}} component does not implement didReceiveAttrs() and so does not properly handle having the mobiledoc change out from under it.

As an aside, I have no idea how to supply a new mobiledoc to an editor instance. Seems like maybe it's not possible...?

@sdhull
Copy link
Author

sdhull commented Dec 17, 2018

OK after more investigation, I realize it works as long as it's a new mobiledoc hash that the component has never received before.

However, if I send a default mobiledoc to the component (with an empty section, due to autofocus issue), that will cache the document as _upstreamMobiledoc. Then someone uses the editor, causing _localMobiledoc to be set. But when I want to reset the form, I resend that empty mobiledoc and it does nothing (because that default mobiledoc has been cached as _upstreamMobiledoc.

I don't know if the editor component hangs on to two references to mobiledocs for any purpose, but if not, I'd collapse _upstreamMobiledoc and _localMobiledoc into a single _mobiledoc property and that would solve the problem. PR incoming.

@sdhull
Copy link
Author

sdhull commented Dec 17, 2018

(and turns out using willRender instead of didReceiveAttrs is fine)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant