question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Editing a record throws Total from response is not a number error

See original GitHub issue

What you were expecting:

Expect it won’t log any error in console when changing filter on a ReferenceManyField What happened instead:

Total from response is not a number error is shown in console when filter prop is changed on ReferenceManyField Steps to reproduce:

  1. Go to codesandbox https://codesandbox.io/s/elastic-surf-urpjz
  2. Edit a post -> go to comments tab
  3. I added a body filter to filter comments in the comments tab in PostEdit.js. Change the body filter by typing some characters
  4. Total from response is not a number. Please check your dataProvider or the API error is thrown in console

Screenshot 2020-01-22 at 1 25 38 PM

Related code:

https://codesandbox.io/s/elastic-surf-urpjz

Other information:

This is the line which throws the error https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/dataProvider/useQueryWithStore.ts#L121.

I wonder if the check here https://github.com/marmelab/react-admin/blob/master/packages/ra-core/src/dataProvider/useQueryWithStore.ts#L119-L120 is suitable for useGetManyReference / ReferenceManyField.

When the filter prop is changed, useGetManyReference will use a new relatedTo to select ids & total from store, but we are comparing them against the old relatedTo (generated using old filter prop)'s ids & total.

Environment

  • React-admin version: Latest
  • Last version that did not exhibit the issue (if applicable):
  • React version:
  • Browser:
  • Stack trace (in case of a JS error):
Total from response is not a number. Please check your dataProvider or the API. 
    in Anonymous (at PostEdit.js:151)
    in PostEdit (created by WithPermissions)
    in WithPermissions (created by Router.Consumer)
    in Router.Consumer (created by Route)
    in Route (created by ResourceRoutes)
    in ResourceRoutes (created by Resource)
    in Resource (at src/​index.js:40)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:22 (13 by maintainers)

github_iconTop GitHub Comments

7reactions
christianlusardicommented, Mar 14, 2020

Same error using BulkDeleteButton and redirect to a list view

6reactions
josephktcheungcommented, Mar 13, 2020

Okay I have reproduced it. v3.3.0 solved the ReferenceManyField issue but the same error appears multiple times after I update a post. Attached gif:

ezgif-7-f86b878b8525

Read more comments on GitHub >

github_iconTop Results From Across the Web

Editing a record throws Total from response is not a number ...
Editing a record throws Total from response is not a number error.
Read more >
Common error messages in Data Loader - Salesforce Help
Cause: User is attempting to update a unique field. See Error 'Duplicate value found' when updating records using Data Loader for more details....
Read more >
Common Salesforce Flow Errors and How to Troubleshoot Them
In flows, SOQL is mainly used in Update Records or Create Records ... Make sure the step prior to updating the Result record...
Read more >
More on data validation - Microsoft Support
If users enter more than the limit amount, they see an error message. Data Validation Input and Error Messages. You can choose to...
Read more >
Power Apps Patch Function Error Handling - Matthew Devaney
Record – the complete record that failed update in the database. This will always be blank when creating a record. To improve the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found