go-frontend icon indicating copy to clipboard operation
go-frontend copied to clipboard

Remove call to appeals endpoint with limit=1000

Open batpad opened this issue 4 years ago • 0 comments

We currently call the getAppealsList action in a few places on the frontend. This makes a call to the Appeals API with limit=1000: https://github.com/IFRCGo/go-frontend/blob/develop/src/root/actions/index.js#L232

We seem to call getAppealsList in the appeals-table component where we don't need to and it should be trivial to move to properly paginated API calls :

  • The call in appeals-table: https://github.com/IFRCGo/go-frontend/blob/develop/src/root/components/connected/appeals-table.js#L346 - we should be able to remove this and only make paginated calls to getAppeals: https://github.com/IFRCGo/go-frontend/blob/develop/src/root/actions/index.js#L537.

The one that seems a bit more work to remove is the call inside the presentation-dash component: https://github.com/IFRCGo/go-frontend/blob/develop/src/root/components/connected/presentation-dash.js#L8

This is likely going to be a bit more work since the presentation dash currently needs all appeals to figure out what to display on the map - not sure if this can be helped by creating an endpoint that aggregates by country or so.

This might not be urgent since I see we still receive a total of 66 appeals from the backend, but it is something we should fix since we don't want to allow calls to the API with that high a limit. Perhaps an alternative would be to just use paginated requests as elsewhere to break up the request into multiple chunks.

Would be good to tackle at some point.

cc @tovari

batpad avatar Jul 14 '21 12:07 batpad