Griddle icon indicating copy to clipboard operation
Griddle copied to clipboard

How to tell Griddle that external data is loading ?

Open anujgakhar opened this issue 7 years ago • 3 comments

Griddle version

1.9

Expected Behavior

To show Loading state when external data is loading on Next or Previous button click

Actual Behavior

I see a 'No results found' message when the call is in flight because the current dataLoadingSelector just checks for existence of data

Steps to reproduce

Whenever I hook in the onNext and onPrevious events to fetch external data

I've written my own plugin that changes some of the Pagination components and buttons and it works well. However, when I click 'Next' or 'Previous', instead of seeing a 'Loading' state, I see a 'NoResults' state in the Table. Is there an easy way to tell Griddle that external data is loading so it can show the correct state ?

anujgakhar avatar Nov 19 '17 17:11 anujgakhar

I would expect you could dispatch GRIDDLE_UPDATE_STATE (actions.updateState) with { data: null } to switch back to Loading. Or there's no reason you couldn't use reducers for the pagination action types to set/unset an explicit Loading state.

dahlbyk avatar Nov 20 '17 03:11 dahlbyk

@dahlbyk thanks for the reply, you got an example of this? I can't seem to get it working. If I dispatch an actions.updateState onClick of NextButton, there's a runtime error at line 60 of dataUtils.js

anujgakhar avatar Nov 25 '17 17:11 anujgakhar

I do not have a working example handy, no. If you could put together a basic repro I would be glad to take a closer look.

dahlbyk avatar Nov 26 '17 04:11 dahlbyk