Found while building the JS unit test layer (mount-sweep).
MultiField.js uses a default parameter value = []. When value is undefined, a fresh [] is created on every render; useMulti's useEffect(..., [value]) then sees a new reference each time and calls setCollapsed([]), producing an infinite re-render loop.
Production never hits this today because prepare_items_for_js() always passes a concrete array, and the unit tests seed a stable value to match that contract — but any future caller mounting a multi_* field without a value (e.g. a custom integration or a Gutenberg block with no attribute default) will loop.
Suggested fix: hoist a module-level const EMPTY = [] as the default (or memoize), keeping the effect's dependency stable.
Found while building the JS unit test layer (mount-sweep).
MultiField.jsuses a default parametervalue = []. Whenvalueisundefined, a fresh[]is created on every render;useMulti'suseEffect(..., [value])then sees a new reference each time and callssetCollapsed([]), producing an infinite re-render loop.Production never hits this today because
prepare_items_for_js()always passes a concrete array, and the unit tests seed a stable value to match that contract — but any future caller mounting amulti_*field without a value (e.g. a custom integration or a Gutenberg block with no attribute default) will loop.Suggested fix: hoist a module-level
const EMPTY = []as the default (or memoize), keeping the effect's dependency stable.