osstotalsoft / rocket-ui-ts

A collection of reusable and composable React components written in TypeScript built on top of Material UI Core V5
MIT License
19 stars 4 forks source link

Autocomplete enters infinite rerender loop when typing in input #90

Closed st-angelo closed 4 months ago

st-angelo commented 11 months ago

Latest version

Current behavior

When typing in an Autocomplete with loadOptions defined, an infinite rerender loop may trigger. It happens when the load function is instantaneous (like when the result is already cached when working with apollo client).

Sometimes it's reproduced just by accessing the page containing the control, with no extra user input.

Only happens with simpleValue.

Expected behavior

No infinite rerendering happens.

Steps to reproduce

Reproduced in this sandbox: https://codesandbox.io/p/sandbox/modern-bush-h73lvg (add the delay to the load function to see that the problem goes away when loading is not instantaneous).