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

Colliding ids for disableGetMany option

KonkretneKosteczki opened this issue · comments

I've been trying to use the module with react-admin-firebase, however react-admin-firbease does return objects for the getMany calls (with just ids) even if those do not exist, which forced me to use the getOne instead.

However, It seems that when resource is successfully obtained via getOne the id is marked as non colliding, and when there is an error when querying the resource it is marked as colliding, which is the exact opposite of how it should work.

return dataProvider.getOne(resourceName, {id})
.then(_ => undefined)
.catch(_ => id);

Simply replacing the return value of then with return value of catch and vice verse should fix the issue.

Is this repository dead? this doesn't seem like that much of an issue to fix this bug. Why should a function return the id if the app did find an object with the same id, and not return it otherwise.

Is this repository dead? this doesn't seem like that much of an issue to fix this bug.

I'm very busy at the moment, feel free to contribute a PR if it's an easy bug to fix 👍