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.

Redundant call to items in SelectArrayInput

See original GitHub issue

Is your feature request related to a problem? Please describe. When I have basic usage of SelectArrayInput with ReferenceArrayInput and I know referenced data items will be always less than page size because they’re static, I would like to avoid Get many call to selected items inside useReferenceArrayInputController as it doesn’t make sense to fetch the data again, I have all data I need and I (as a developer) assure that.

<ReferenceArrayInput source="allowedRegions" reference="region">
   <SelectArrayInput placeholder="Choose" />
 </ReferenceArrayInput>

my point is that there is no filter query parameter for these simple static (enum like) endpoints at our API.

Describe the solution you’d like Allow manual suspend of request to getMany items in useReferenceArrayInputController

something like

<ReferenceArrayInput source="allowedRegions" reference="region" suspendGetManyFetch>
   <SelectArrayInput placeholder="Choose"  />
 </ReferenceArrayInput>

Describe alternatives you’ve considered Don’t have an idea how to solve this better 🤷‍♂️

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:2
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
horaklukascommented, Aug 16, 2022

I meant it to be a static property, not changing over time. Once you know your api returns less than 10 items all the time, as the result is static list, you can use it and don’t worry about missing data. As I said, it would delegate responsibility to the developer…

0reactions
horaklukascommented, Aug 20, 2022

The property you suggest seems reasonable, but I don’t have such deep knowledge of internals. Is the data cache shared between getList and getMany calls? So that if there are already two items in data cache returned by getList

[
  { id: 1, name: 'Greece'},
  { id: 2, name: 'Croatia'}
]

then call to getMany(2) will return the item from the cache?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Code Inspection: Redundant string.Format() call - JetBrains
The String.Format() method is redundant if you use Console.WriteLine() . Console.WriteLine() actually has an overload that calls String.
Read more >
React-admin - Upgrading to v4 - Marmelab
If you need to get possible values for a relationship, use the useGetList hook ... If you're using useQuery to call a regular...
Read more >
Graph streaming real-time data with react and chartjs-Reactjs
... React - Combine data returned two api calls and set state of an array with these values ... export default react without...
Read more >
Referenceinput Is Not Filing The Select Component - ADocLib
An Input component displays an input or a dropdown list a list of radio buttons etc. To fix this problem you should override...
Read more >
Redundant string interpolation and performance
Format call." Update: in fact, interpolations without fill-ins have always been optimized to the resulting string by the compiler. All it does ...
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