-
Notifications
You must be signed in to change notification settings - Fork 8
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
GridModel.selectFirstAsync
should respect intentionally not-mounted grid component
#3633
Comments
GridModel.selectFirstAsync
should respect intentionally not-mounted grid component
In your app code, could you simply not await the call to That said, it does seem like GridModel could do check at the top of I'd suggest a quick look at any other methods there that |
Issue Summary: Attempting the select the first row in an intentionally not-mounted
grid
will cause a three second mask. Agrid
may be intentionally not-mounted if something is chosen to render in its place if its store is empty, for example aplaceholder
component.When calling
selectFirstAsync
on aGridModel
, it first checks itsisReady
property, and waits for it to becometrue
if it isn't already. TheGridModel
'sisReady
is a trampoline from itsAgGridModel
's property, which is evaluated based on whether thegrid
component is fully initialized and mounted.The awaiting occurs when
GridModel
'sselectFirstAsync
calls itswhenReadyAsync
method, which waits forisReady
true, for a default of three seconds. If after the timeout, the grid is still not ready,selectFirstAsync
simply returns. The primary purpose of waiting forisReady
is to allow agrid
component time to mount, if it wasn't already.In some cases, an app may choose to only mount a
grid
if it has rows, and display another component, e.g. aplaceholder
instead. If the app is selecting the first row after loading, then the following will happen after loading theGridModel
with no records:GridModel
with no rows.grid
is not rendered, and another component displayed instead.grid
.grid
is not mounted,isReady
never turns true.GridModel
waits for thegrid
to mount (which never happens), after which it returns.This results in what seems like a performance issue when loading an empty
grid
. A quick workaround is to return in the app'sdoLoadAsync
method after loading theGridModel
, and before attempting to select the first row, if no records where loaded. A more robust fix is forselectFirstAsync
to know whether thegrid
component is intentionally not-mounted, return if so, and only awaitisReady
otherwise.The text was updated successfully, but these errors were encountered: