Get record collection returning old (cached) data

Hello,

I am following some tutorials about creating an REST data resource, and putting on the first page an data variable, some input fields, and an button to CREATE a new record. Below there is a list of records. There is, also, an second page (details) to UPDATE the register.

Creation and updating of data are working fine. Data is updated in the API database. The problem is that “Get record collection” is receiving old data. Its seems not to be not making the request, but instead returning a cached version of the data.

As a result, the records list on the first page is not updating after a record editing. The test in the “GET COLLECTION” tab, in the data configurator, also returns old data.

VS Code REST Client gets the updated data. Direct browser access of the API also returns updated data.

Opening DevTools in Chrome and checking “[x] Disable Cache (while DevTools is open)” makes the app runs correctly and gets updated data. And the data configurator test also works.

What can I do to solve this problem? Did I messed some configuration?

Thanks,
Márcio

Hello,

I have created a new endpoint in my API, and an new Appgyver app.

Within this new and clean app I just used the data configurator test for Get Record Collection. And the same problem happens: on the first request updated data is get. But somehow this data is cached. After this, all requests made by Get Record Collection (in the app or in the data configurator test) only returns the cached data.

Updated data is only get by Get Record Collection if “Disable cache” is enabled on the Developer Tools. I tested this on Chrome and Firefox with the same results.

Other REST clients access updated data from the same API, but AppGyver don’t.

Any ideas?

Thanks,
Márcio

Hi @Marcio_Moreira, I haven’t encountered this happening before and couldn’t get it to reproduce on my own REST API integrated resource. Would it help to include a Cache-Control: no-cache or Cache-Control: max-age=0 header in the requests? You can add it in the data configurator:

Hello @Mari,

Both headers worked: Cache-Control: no-cache and Cache-Control: max-age=0.

But I had to do a small change on my server to allow “Cache-Control”: django - Request header field … is not allowed by Access-Control-Allow-Headers in preflight response - Stack Overflow

It makes me thing the configuration of the API server (Django Rest Framework) had something to do with the original problem of caching data. But, by the other side, other REST clients had no trouble getting current data, only AppGyver. So I don’t really know what happened.

I would like to say that I really liked AppGyver. It’s not just functional, but kind of elegant. Congratulations to the Team.

Thank you Mari

1 Like