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

Use dynamic context for "card context" #1191

Merged
merged 3 commits into from
Apr 23, 2024
Merged

Use dynamic context for "card context" #1191

merged 3 commits into from
Apr 23, 2024

Conversation

lukemelia
Copy link
Contributor

@lukemelia lukemelia commented Apr 22, 2024

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.

Copy link

github-actions bot commented Apr 22, 2024

Test Results

590 tests  ±0   586 ✔️ ±0   8m 43s ⏱️ -1s
    1 suites ±0       4 💤 ±0 
    1 files   ±0       0 ±0 

Results for commit 91cd9f7. ± Comparison against base commit 0fe906c.

♻️ This comment has been updated with latest results.

Copy link
Contributor

@jurgenwerk jurgenwerk left a 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;
Copy link
Contributor

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",
Copy link
Contributor

@habdelra habdelra Apr 23, 2024

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)
Copy link
Contributor

Choose a reason for hiding this comment

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

very cool!

@lukemelia lukemelia merged commit 7eb13f3 into main Apr 23, 2024
29 checks passed
@delete-merged-branch delete-merged-branch bot deleted the dynamic-scope branch April 23, 2024 22:25
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.

4 participants