This repository was archived by the owner on Feb 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Committing staged ListInputBox entries #73
Copy link
Copy link
Open
Description
Solon/src/components/form/ListInputBox.jsx
Lines 27 to 31 in ac30a1c
| const addItem = (callback) => { | |
| let newState = stagedValue ? [...value, stagedValue] : value; | |
| setStagedValue(''); | |
| onChange(newState); | |
| }; |
In Voices' page component Metadata.jsx, there appears to be logic that assumes that:
- a user might enter a value into the
ListInputBoxcomponent but not clickAdd Itemand - we want to commit and use the staged value upon form submission
Therefore, Metadata.jsx creates a ref and passes it into ListInputBox (ListInputBox is still a class component in Voices). Metadata then uses the addItem method on the ListInputBox component via the ref to commit any staged values upon form submission.
Now that ListInputBox is a functional component, ancestors can no longer access its "methods" and logic like what I described above will have to be reimagined.
This issue prompted by this discussion.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels