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

[REFACTOR] Migrate provide / inject syntax to reusable composables #641

Open
maartenvanhunsel opened this issue Feb 20, 2024 · 2 comments
Open
Labels
enhancement New feature or request

Comments

@maartenvanhunsel
Copy link

Description

Numerous composables we utilize are closely integrated with each other. Nevertheless, the current integration approach renders several key Nuxt/Vue features unusable, which is regrettable. Specifically, Plugins and Middlewares become inaccessible for Shopware-related composables due to the necessity of utilizing useContext with inject(), a feature restricted to the setup function.

As a developer, it is crucial to have the user context at the earliest stage possible. By fetching data from the app.vue, we inadvertently overlook numerous valuable functionalities that could enhance the user experience.

Use Case

Authentication

Proposed Solution

I recommend adopting a more composable approach such as useAuth from @sidebase/nuxt-auth. This solution is remarkably user-friendly, eliminating the requirement for provide and inject.

Alternatives Considered

I have reviewed #26, and I firmly believe that this approach is not sustainable. It risks misrepresenting the core concepts that should guide our efforts.

Additional Context

I am happy to assist and engage in discussions for a sustainable solution that allows us to leverage the best of both (Shopware / Nuxt) worlds.

@maartenvanhunsel maartenvanhunsel added the enhancement New feature or request label Feb 20, 2024
@maartenvanhunsel
Copy link
Author

maartenvanhunsel commented Feb 23, 2024

@elkmod see refactor demo as we discussed earlier.

@ignasradzius
Copy link

I like your idea as I ran into limitation of using useUser composable in the middleware as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Developer Backlog
Development

No branches or pull requests

2 participants