Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.
This repository was archived by the owner on Feb 2, 2024. It is now read-only.

Committing staged ListInputBox entries #73

@nsmedira

Description

@nsmedira

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:

  1. a user might enter a value into the ListInputBox component but not click Add Item and
  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions