-
-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
feat(runtime): support delay initializing props (fix #2325) #2353
Conversation
Isn't this a bit overkill though? Maybe looking through the vnode attrs to check if the value needs to be set one tick after instead of using mounted like in 54ed759 works |
I'm not sure if this change is appropriate in fact.
I've considered a similar approach, but when it comes to async prop initializing, it's hard to guarantee that there's no sequential conflict under special conditions. Also I'm confused about where to set attr on vnode for such special delay requirements. And after all we need to judge such special conditions in the runtime-core. I've also considered a less general solution with no runtime cost, that is, moving |
I meant reading from
Maybe that's the best solution but I imagine it would still be a problem in JSX and manual render functions |
gotcha. |
@posva https://jsben.ch/wP8Q4 |
I was only talking about setting I don't really understand what you want to say with the jsbench 😅 |
well there may be some misunderstanding. plz allow me to explain
so this pr provides a way to delay initializing certain props (such as sorry to puzzle you. |
@unbyte Can you fix the conflict? this needs to be rebased now. |
@HcySunYang |
@unbyte Thanks |
@unbyte There is a conflict again, can you please resolve the conflict again 🤣 |
See ff0c810 - while the changes proposed in this PR are technically correct, they introduce a bit too much overhead / complexity for a very finite special case. I decided to just special case |
runtime-core
provide a render option called
delayInitProp
, which receivesel
andkey
, returns whether delay or the priority.benchmark: https://jsben.ch/wP8Q4 loop vs bench
return value
true
or number greater than 0 means put this prop at the end of the delayed queuefalse
or 0 means no need to delayruntime-dom
delay initializing
value
fix #2325