-
Notifications
You must be signed in to change notification settings - Fork 19
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
ChangesetForm: Only allow changeset as argument, removing auto mode #124
ChangesetForm: Only allow changeset as argument, removing auto mode #124
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for working on this.
This is an interesting use case. I think with a few changes, you can use the changeset args.
packages/changeset-form/addon/components/changeset-form/index.hbs
Outdated
Show resolved
Hide resolved
packages/changeset-form/addon/components/changeset-form/index.ts
Outdated
Show resolved
Hide resolved
packages/changeset-form/addon/components/changeset-form/index.ts
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,15 @@ | |||
{{yield |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need a correspondent TS/Js file here, I'm not sure if template-only components work in addons.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are good, reference: https://discuss.emberjs.com/t/can-addons-use-template-only-components/17399/6?u=betocantu93
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes are looking real good!
Can you also update the docs demos to match this refactor?
Looking good! Let's try to get CI green, then we should be ready to ship. |
Thank You @betocantu93 for your work on this. |
ChangesetForm Refactor
This PR aims to provide more simple yet flexible api for ChangesetForm component.
The component serves as a lightweight mechanism for common tasks, like preventing browser native event reload on submit, persisting or rolling back changes to the changeset and providing contextual components with some predefined args like
@changeset
to all types of inputs, and so, preventing typos and boilerplate needed in order to support ChangesetForm FieldsIt builds on top of a new utility/ergonomic component called
<ChangesetForm::Context />
which serves as a way to pass down common args like the changeset to all of the types of inputs. This allows the client to optionally use it to build custom forms without much hassle.This PR also introduces a new feature and a breaking change.
Feature:
Breaking change:
Previously we had two "modes":
@changeset
@model
and optionally@validations
Auto mode is deprecated, now you must provide a changeset to the component, you can easily do it by using the
changeset
helperBefore:
After: