-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Add measure hook #11506
Comments
@krisselden why not just schedule the measure into actions from |
because other didRender hooks including this one, may actually schedule stuff on actions. This mix will result in interleavings we aim to avoid with the bucketed run-loop approach. |
Most of the time, measure will not cause a schedule revalidate. @stefanpenner I think he means schedule the thing that would cause the invalidation. I think would work, I will try that. We only need it in the list view case, if we run out of reuse-able bins and need to add more, because a size estimate was not correct. |
didRender(){
Ember.run.scheduleOnce('actions', this, this.confirmDimensions)
} would result in, |
@stefanpenner can you unpack that?
Are you suggesting that If there is no difference in the timing, then you suggest the only difference is if the warning about poor performance is logged? |
the cost should be minimal function invokeDidRender() {
if (this.measure) { this.measure(); }
warnAgainstRevalidation(this, this.didRender);
} |
alternatively, a power-user helper could exist. didRender() {
dontWantDepcrecation (function(){
doThingThatMayChecksDimensionsAndMayCauseChanges();
})
} |
I'm foreseeing a warning like:
At which point most devs just dump all the logic into I guess I'm saying that I like the idea of somehow informing people that they have done something that might be bad, but that a second junk drawer to silence the message does not seem great to me. |
then it should be some power-user helper. The reality is, multi-pass layouts are a norm for UI development. Some-how we should expose something to allow for this, throwing something onto another queue, doesn't seem correct either. |
I do not necessarily prefer the approach, but @eccegordo is advocating for us to handle this at the logging level instead: emberjs/rfcs#65 (comment) log the warning, but have some silencing system (I have no idea how you would persist that though). |
@mixonic At the end of the day I care mostly that whatever messages, warning, deprecations, etc are emitted from the system are reasonably actionable. And silencing the message is one potentially valid course of action. There are of course different ways to tackle this problem generally. I am just thinking about the case where we help relatively inexperienced devs effectively "divide and conquer" the problem if they are faced with a flood of warnings when they go to update their project. |
@eccegordo you don't need to address every deprecation right away, deprecations are not breaking, they are just flagging things that will go away eventually. |
@krisselden understood. Actually I was trying to clear everything on 1.13 so I could immediately try 2.0. Unfortunately, the inspector is/was broken so I couldn't use that interface to review the deprecations and so having to wade through a lot of noise being spewed in the console. Which was what prompted the desire to selectively silence some warnings. Plus I have bad OCD 😄 |
@krisselden this should likely be an RFC, or an issue proposal to the RFC repo. |
I have moved this to emberjs/rfcs#134 according to @stefanpenner's last comment. Please continue the discussion there, thank you everyone. |
Add a measure hook that corresponds to didRender that silences deprecation notice for scheduling a revalidation during render.
Currently if you cause a revalidation of render during render you get a deprecation during rendering implying that support for this will eventually go away. There still exists a use case for this, where you need to render something different based on measurements of what has been rendered so far.
An example would be if you increase the height and wanted to add an additional subtree like list-view.
The text was updated successfully, but these errors were encountered: