Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creators auto-complete #410

Closed
wants to merge 6 commits into from
Closed

Creators auto-complete #410

wants to merge 6 commits into from

Conversation

slint
Copy link
Member

@slint slint commented Jan 25, 2022

Changes introduced from the creatibutors auto-complete feature branch. Some notes for the reviewer:

  • We went with using Refs (which is horrible practice), since refactoring the underlying components to make state change handlers parametrized via props ended up being very messy/difficult, with unknown implications for other uses. If this is too hack-ish, we're up for refactoring, but we'll need some prior discussion/guidance for the specifics.

(Closes #397)

formikProps.form.setFieldValue(path, value);
});
// Update identifiers render
this.identifiersRef.current.setState({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a quick look (but I am probably wrong), in general this is a sign that the state should be handled by the upper component.
If you remove the state selectedOptions from CreatibutorsIdentifiers, and you manage it in this cmp, you should have here:

this.setState({selectedIdentifer: ....})

in the render method, you pass it as a prop, so that CreatibutorsIdentifiers will re-render with this new selectedIdentifier. You will also handle the callbacks and formik set in the upperCmp: the inner one will become very dummy.

If the logic in this upper becomes very messy, you can always introduce a middle cmp, between the 2, where the middle one encapsulates/manages the state of the inner one and the upper one is a bit lighter...
I had to do something similar in the PIDs cmp.

Happy to chat IRL :) I hope it helps (even if I am very positive that you have already thought about this).

@slint
Copy link
Member Author

slint commented Feb 21, 2022

Squash-merged manually in 04eba96 (but GitHub doesn't detect that...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

creatibutors modal: add support suggestion and autofill
3 participants