benwinding / react-admin-import-csv

A csv file import button for react-admin

Home Page:https://benwinding.github.io/react-admin-import-csv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with app cache

diegocgaona opened this issue · comments

If I use the application cache suggestion from https://marmelab.com/react-admin/Caching.html#application-cache , the import button do not work

const cacheDataProviderProxy = (dataProvider, duration =  2 * 60 * 1000) =>
    new Proxy(dataProvider, {
        get: (target, name) => (resource, params) => {
            if (name === 'getOne' || name === 'getMany' || name === 'getList') {
                return dataProvider[name](resource, params).then(response => {
                    const validUntil = new Date();
                    validUntil.setTime(validUntil.getTime() + duration);
                    response.validUntil = validUntil;
                    return response;
                });
            }
            return dataProvider[name](resource, params);
        },
    });

export default cacheDataProviderProxy(myDataProvider);

With the cache active, the import button do not make an API call, it stops as the image bellow:
image

If I delete it and use the myDataProvider, it works fine.

Is there a solution?

Thanks!!