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

Runtime component customization with updateAppConfig #2828

Open
izoukhai opened this issue Dec 3, 2024 · 2 comments
Open

Runtime component customization with updateAppConfig #2828

izoukhai opened this issue Dec 3, 2024 · 2 comments
Labels
enhancement New feature or request v3 #1289

Comments

@izoukhai
Copy link

izoukhai commented Dec 3, 2024

For what version of Nuxt UI are you asking this question?

v3.0.0-alpha.x

Description

I want to customize my app.config.ts file from an external source.

Consider the following:

// plugins/config.ts

export default defineNuxtPlugin({
  async setup(nuxtapp) {
    const config = await fetchConfig()
    // output: {ui: {primary: "violet", button: {slots: {base: "hidden"}}}}

    if (config?.app_config) {
      updateAppConfig(config.app_config);
    }
  },
});

The primary color is updated correctly, but the hidden class is not applied to buttons.
Any ideas why?

@izoukhai izoukhai added the question Further information is requested label Dec 3, 2024
Copy link
Member

This is nice idea! However, the issue is components merge the default config with #build/app.config for performance reasons, this is one of the reason HMR is not working when changing the App Config and you have to reload the page.

@izoukhai
Copy link
Author

izoukhai commented Dec 4, 2024

Hey @benjamincanac thanks for the answer!

So I guess it's not possible, unless I manage to call updateAppConfig before Nuxt UI reads app.config.ts ?

@benjamincanac benjamincanac added enhancement New feature or request v3 #1289 and removed question Further information is requested labels Dec 5, 2024 — with Volta.net
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request v3 #1289
Projects
None yet
Development

No branches or pull requests

2 participants