Git Product home page Git Product logo

Comments (5)

Atinux avatar Atinux commented on July 28, 2024

Hi @katerlouis

Actually this is not possible for Nuxt 2 since we use router.beforeEach to force the color mode before navigating: https://github.com/nuxt-community/color-mode-module/blob/2ca9edc4f2f55970a8f147565eb49c8d84f8157a/lib/templates/plugin.client.js#L91-L105

We cannot have the asyncData result inside, this could work in Nuxt 3 since we use <Suspense>.

from color-mode.

katerlouis avatar katerlouis commented on July 28, 2024

Do you think this could work when using Nuxt bridge? I'm not sure if Suspense is also supported in Nuxt bridge.

from color-mode.

Atinux avatar Atinux commented on July 28, 2024

It might be possible, but still a bit early to say.

from color-mode.

katerlouis avatar katerlouis commented on July 28, 2024

@Atinux Any chance I'm lucky and it is possible today? Because we are still very much in Need for this. :(

I would offer my help to contribute (if I get a kick start on it, I think I am capable of helping 8))

(We can't run Nuxt-bridge, though... we however do have @nuxtjs/composition-api up and running)

EDIT: Just an idea, – does it need to come from asyncData? Or could the initial color mode technically be pulled from a store state based on the routes path? I could cook up a route-to-colormode-map that gets pulled in nuxtServerInit.

from color-mode.

katerlouis avatar katerlouis commented on July 28, 2024

@Atinux I won't give up! :D
AI chat bot Phind had some pretty good ideas and even had me in hope at some point.
Interesting conversation: https://www.phind.com/search?cache=64d5f47a-5a8c-44d3-9bf1-cd7bada8c9fb

from color-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.