Code Monkey home page Code Monkey logo

Comments (5)

osban avatar osban commented on August 16, 2024

As far as I can tell, the attrs and state that you're passing from Parent to Option might be the unaltered vnode ones that have been passed to the Parent, and I'm assuming initParentState is changing the Parent state, and not the vnode.state. I'm guessing you want to achieve something like this (sorry, it's in hyperscript, not JSX)?

from mithril.js.

EverettMcKay avatar EverettMcKay commented on August 16, 2024

Thanks, Oscar!

I have a clue: the problem is the spread operator. Could be spreading multiple objects or perhaps doing that in jsx. (Note that spreading a single object works just fine.) Either way, I tried every combination of spread I could think of without success. I figured out a reasonable way that doesn't involve spreading and that is now working.

from mithril.js.

EverettMcKay avatar EverettMcKay commented on August 16, 2024

I don't know how embarrassed I should feel, but I think I just discovered that "tag" is a reserved attribute name in mithril. I was passing a tag attribute. Doh!

Is there a way to flag that?

from mithril.js.

EverettMcKay avatar EverettMcKay commented on August 16, 2024

Will close. Would love to see this flagged during runtime though.

from mithril.js.

dead-claudia avatar dead-claudia commented on August 16, 2024

Will close. Would love to see this flagged during runtime though.

Unfortunately, it's basically impossible, since in the locations where it could be special, we have no knowledge of whether it's a vnode or attributes object.

If in doubt, use m.censor. It's not yet immediately visible in the main docs, but that I believe is fixed in next and will show the next time the docs are updated.

We do make sure that if you provide us a non-vnode when only a vnode is accepted, you will be able to spot the error. But unfortunately, Mithril doesn't know the context in which it's called, so it can't tell apart attributes from child vnodes.

from mithril.js.

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.