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

feature(composable): create utility composable useHybridInject #1418

Merged

Conversation

CachedaCodes
Copy link
Contributor

@CachedaCodes CachedaCodes commented Feb 20, 2024

EMP-3558

Motivation and context

The regular vue 3 inject doesn't work with the XProvide, so this utility composable functions as a stepping stone for the migration between the two. It works with any of them and it should be removed when the migration to vue 3 is completed.

  • Dependencies. If any, specify:
  • Open issue. If applicable, link:

Type of change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to not work as expected)
  • Change requires a documentation update

What is the destination branch of this PR?

  • Main
  • Other. Specify:

How has this been tested?

Create a injected test vue component and a provider test vue component. Wrap the injected test component in the provider. Now, the injected test component should use the composable and the provider component should do the providing.
Create the provider component so it uses the @XProvider decorator and has a dynamic property that provides to its children (for example, a property that changes with a button). The injected test component should pick it up correctly and change dynamically. Then, do the same but with defineComponent and the vue 3 provide.

Unit tests not created due to this being a utility that will be removed in the future.

@CachedaCodes CachedaCodes requested a review from a team as a code owner February 20, 2024 10:56

/**
* Function to use a hybrid inject, which allows to inject a value provided by the regular provide
* of vue or by the XProvide decorator.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
* of vue or by the XProvide decorator.
* of vue or by the XProvide decorator.

Copy link
Contributor

@annacv annacv left a comment

Choose a reason for hiding this comment

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

gj!

@annacv annacv merged commit 1631be4 into main Feb 21, 2024
4 checks passed
@CachedaCodes CachedaCodes deleted the feature/EMP-3558-utility-composable-to-handle-inject-migration branch February 21, 2024 09:42
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.

2 participants