Coder Social home page Coder Social logo

Comments (3)

DustinJSilk avatar DustinJSilk commented on September 28, 2024

Try changing line 17 to {isShowing.value && <ClientOnlyComponent />}

from qwik.

williamsdyyz avatar williamsdyyz commented on September 28, 2024

Try changing line 17 to {isShowing.value && <ClientOnlyComponent />}

Yes, that will work for sure, but I can already work around the issue. The point is that totally valid code causes the runtime to throw an error and quit.

The Stackblitz project is the simplest form I could find that would reproduce the problem. It's not representative of the code I'm actually trying to write (something similar to the Portals example in the docs)

The bit that's interesting is the code was initially using useComputed:

const Comp = useComputed$(() =>
  isShowing.value ? ClientOnlyComponent : undefined
)
return(
   ....
   {Comp3.value && <Comp3.value />}
   ....
)

Which also didn't work, but this did

const Comp = isShowing.value ? ClientOnlyComponent : undefined;
...
{Comp && <Comp />}

which is why I tried contriving what's in the Stackblitz code

const Comp = isShowing.value ? { value: ClientOnlyComponent } : {}
...
{Comp.value && <Comp.value />}

What's the difference between 2 & 3? Why does having Comp stored in an object propety make a difference?

from qwik.

wmertens avatar wmertens commented on September 28, 2024

qwik only serializes context that is used during SSR. Are you using useLocation anywhere during SSR? If not, add it somewhere.

This is a feature to prevent sending useless context data to the client.

If this was the problem, how should the error message have been changed to make this clear to you?

from qwik.

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.