Right now, we can't really check if an accordion's initialExpanded or initialDisabled contain strings that don't actually pertain to an accordion section ID.
The issue is, right now, useAccordion doesn't know who its accordion sections are during the initial render. It only has some recognition of them once they are individually mounted and run the callback ref. Hypothetically, useAccordion could have some array in React's state and push to that array every time a section is mounted and runs the callback. But that would mean re-rendering the entire accordion each time a section is mounted, which seems not ideal.
Because we don't know who the sections are, we can't check for bad IDs when using initialExpanded or initialDisabled. Say allowMultiple === true and someone passes in an initialExpanded with multiple strings. Right now, we simply initialize the state by getting rid of all of the elements except for the first one. If someone accidentally passes in bad IDs, whichever section they wanted to be expanded won't be.
Right now, we can't really check if an accordion's
initialExpanded
orinitialDisabled
contain strings that don't actually pertain to an accordion section ID.The issue is, right now,
useAccordion
doesn't know who its accordion sections are during the initial render. It only has some recognition of them once they are individually mounted and run the callback ref. Hypothetically,useAccordion
could have some array in React's state and push to that array every time a section is mounted and runs the callback. But that would mean re-rendering the entire accordion each time a section is mounted, which seems not ideal.Because we don't know who the sections are, we can't check for bad IDs when using
initialExpanded
orinitialDisabled
. SayallowMultiple === true
and someone passes in aninitialExpanded
with multiple strings. Right now, we simply initialize the state by getting rid of all of the elements except for the first one. If someone accidentally passes in bad IDs, whichever section they wanted to be expanded won't be.