You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I implemented a query search which filters the data shown in a pagewise list while the user is typing in the input text. Every time the user writes a new character in the input text a function is triggered which resets() the PagewiseLoadController to force to fetch new data from page 0... this works fine if the user types slow, but if the text is entered fast then the reset() gets called while there is data being fetched and this produces unexpected duplicated results. This occurs because fetchNewPage is asynchronous and reset doesn't take into account if fetchNewPage is in progress or not, then fetchNewPage could get called twice consecutively and not between resets.
For example:
controller.reset();
controller.reset();
This two calls above should first reset the information of the controller and then fetchNewPage when the _itemBuilder gets called and then again reset the information of the controller and then fetchNewPage when the _itemBuilder gets called again, but instead the reset is called twice consecutively and the fetchNewPage gets called twice consecutively, because as I said the reset is a sync function and the fetchNewPage is an async function.
Solution: the reset function should wait for fetchNewPage to complete in order to do a reset.
The text was updated successfully, but these errors were encountered:
I implemented a query search which filters the data shown in a pagewise list while the user is typing in the input text. Every time the user writes a new character in the input text a function is triggered which resets() the PagewiseLoadController to force to fetch new data from page 0... this works fine if the user types slow, but if the text is entered fast then the reset() gets called while there is data being fetched and this produces unexpected duplicated results. This occurs because fetchNewPage is asynchronous and reset doesn't take into account if fetchNewPage is in progress or not, then fetchNewPage could get called twice consecutively and not between resets.
For example:
controller.reset();
controller.reset();
This two calls above should first reset the information of the controller and then fetchNewPage when the _itemBuilder gets called and then again reset the information of the controller and then fetchNewPage when the _itemBuilder gets called again, but instead the reset is called twice consecutively and the fetchNewPage gets called twice consecutively, because as I said the reset is a sync function and the fetchNewPage is an async function.
Solution: the reset function should wait for fetchNewPage to complete in order to do a reset.
The text was updated successfully, but these errors were encountered: