-
Notifications
You must be signed in to change notification settings - Fork 10
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
Use dynamic context for "card context" #1191
Conversation
d92c3d0
to
91cd9f7
Compare
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.
LGTM, I've checked the https://github.com/customerio/ember-provide-consume-context addon, looks great to be able to pass things down so easily
}; | ||
|
||
export class CardContextConsumer extends Component<CardContextConsumerSignature> { | ||
@consume(CardContextName) declare dynamicCardContext: CardContext; |
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.
very cool!
@@ -21,6 +21,7 @@ | |||
"tracked-built-ins": "^2.0.1" | |||
}, | |||
"peerDependencies": { | |||
"ember-provide-consume-context": "^0.3.1", |
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.
nice use of peer dep!
@@ -173,9 +175,10 @@ export default class OperatorModeStackItem extends Component<Signature> { | |||
return this.args.index + 1 < this.args.stackItems.length; | |||
} | |||
|
|||
@provide(CardContextName) |
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.
very cool!
This is a stepping stone toward our refactor from the @model/@fields template API. It introduces ember-provide-consume-context and uses it to convert the way that provide the cardComponentModifier and actions to cards from using prop drilling to using dynamic context.