-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
useDecorate return default method,not the override in custom in some case #4277
Comments
I think #4152 removed Children component which caused the editor's children using incorrect decorate function. |
yes,u r right |
I think this happens because in A simple fix would be to add a component wrapper in |
not really meaningful, since without Children component, useDecorate is indeed useless than before (directly pass the decorate func down to Element). on the other side, changing decorate function is not such a good idea in some cases, it is still too expensive because it almost re-renders all, but in some cases (e.g. remote caret) we do only want a few specific elements got re-rendered. |
OK, my suggestion was just to address the regression ( It sounds like maybe you want to revert the context change? That would of course fix the problem also. |
Well, in my fork, the Children element is still there, and I think keeping
it may reduce re-render of the children if only the element properties
changed. So, generally, I'd like to revert useChildren (restore the
Children element) indeed, though it's not my call.
And, I would suggest to use a fixed decorate function and resolve the
relevant re-render in other way if it applies. As this current issue, it
can be fixed in either way, remove useDecorate, or revert to Children
element. but only adding a wrapper for editor.children does not mean
anything, since useDecorate no longer reduces re-render like before since
the Children element is gone, keeping it there but not functional makes no
sense.
Jake Donham ***@***.***> 于2021年7月25日周日 上午7:24写道:
… OK, my suggestion was just to address the regression (decorate is not
called on all nodes in the document) in a simple way. I don't think this
change
<d86e534>
had the desired effect; useChildren still runs before
DecorateContext.Provider is rendered. To avoid the problem, useChildren
needs to be called in the render of a component contained in
DecorateContext.Provider.
It sounds like maybe you want to revert the context change? That would of
course fix the problem also.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#4277 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABKYHONZUVK2JA6MNLNY73TZNDSBANCNFSM45IPH36Q>
.
--
Ulion
|
Thanks for the explanations! |
Another possible fix would be to change As far as re-rendering goes, it seem like this approach would be the same as the original |
… render tree (ianstormtaylor#4421) * fix ianstormtaylor#4394 without adding extra layers of render tree * oops unused import * Add changeset Co-authored-by: Dylan Schiemann <dylan@dojotoolkit.org>
Description
user can add decorate method on Editable,and it's not work with editor's children because it will use default.
Recording
you can add console.log in use-decorate.ts like this:
export const DecorateContext = createContext<(entry: NodeEntry) => Range[]>( () => { console.log("editor's children call.") return [] } )
Sandbox
no
Steps
no
Expectation
no
Environment
Context
not need
The text was updated successfully, but these errors were encountered: