fix(ui): form state infinite render (#11665)

The task queue triggers an infinite render of form state. This is
because we return an object from the `useQueues` hook that is recreated
on every render. We then use the `queueTask` function as an unstable
dependency of the `useEffect` responsible for requesting new form state,
ultimately triggering an infinite rendering loop.

The fix is to stabilize the `queueTask` function within a `useCallback`.
Adds a test to prevent future regression.
This commit is contained in:
Jacob Fletcher
2025-03-12 15:06:06 -04:00
committed by GitHub
parent 4defa33221
commit b81358ce7e
7 changed files with 65 additions and 7 deletions

View File

@@ -12,6 +12,15 @@ export const PostsCollection: CollectionConfig = {
name: 'title',
type: 'text',
},
{
name: 'renderTracker',
type: 'text',
admin: {
components: {
Field: './collections/Posts/RenderTracker.js#RenderTracker',
},
},
},
{
name: 'validateUsingEvent',
type: 'text',