Do you want to request a feature or report a bug?
bug
What is the current behavior?
I've recently updated to draft 0.11. Congratulations on the big release! It's been great so far except for this one issue. I have a mentions decorator that adds a dropdown when someone types an @ symbol (a la pretty much all social media). Previously, decoratedText would get updated every time someone typed. This works out great. However, now in 0.11, for some reason it works on the first render, and then when you add more letters it doesn't change the prop, and then when you delete letters it does.
It's kind of confusing to describe so I've made a code sandbox here: https://codesandbox.io/s/draft-decorator-issue-eb7fl. Check the console log statements and you'll see what I'm saying once you start typing a @ and then other letters.
Note that I did verify that the strategy is correct. It's actually taken directly from the docs here: https://draftjs.org/docs/advanced-topics-decorators.
What is the expected behavior?
I would expect the decoratedText prop to change every time the strategy is successful, but it doesn't. This did work in 0.10.
Thanks for your help!
Okay I've narrowed it down to this commit: https://github.com/facebook/draft-js/commit/b2f6ed0274a441aeb90b631d4897765a9a37df2f. The previous behavior that was gated behind the gtx feature-flag was what I was previously relying on. Note that I think this was considered in these comments https://github.com/facebook/draft-js/blob/b2f6ed0274a441aeb90b631d4897765a9a37df2f/src/component/handlers/edit/editOnBeforeInput.js#L218-L222 but that actually breaks my decorator. Just curious if I'm doing this wrong or if this should be done in some other way.
@sophiebits sorry to tag you directly, but would you be able to shed some light on that decision?
Any update on this?
I've confirmed this was fixed by the latest release and the code in the referenced commit. Going to close this.
Most helpful comment
Okay I've narrowed it down to this commit: https://github.com/facebook/draft-js/commit/b2f6ed0274a441aeb90b631d4897765a9a37df2f. The previous behavior that was gated behind the
gtxfeature-flag was what I was previously relying on. Note that I think this was considered in these comments https://github.com/facebook/draft-js/blob/b2f6ed0274a441aeb90b631d4897765a9a37df2f/src/component/handlers/edit/editOnBeforeInput.js#L218-L222 but that actually breaks my decorator. Just curious if I'm doing this wrong or if this should be done in some other way.@sophiebits sorry to tag you directly, but would you be able to shed some light on that decision?