GithubHelp home page GithubHelp logo

Comments (2)

keturn avatar keturn commented on May 29, 2024

I think I'm running in to two separate issues here:

  1. The "Cannot redefine property" error comes from the fact that ReactiveElement.connect now calls Object.defineProperty, which means one should not attempt to define the property with normal field declaration syntax in the class body.

(I think it's also worth mentioning that the key used to retrieve the thing from the store is always used to define the name of the property on the Element.)

  1. The store is somehow not updating? debug mode does send a cami:state:change message to the console with the correct newValue, but the store.state retains the old value.

from cami.js.

kennyfrc avatar kennyfrc commented on May 29, 2024

Hi @keturn! Thanks for calling this out.

My mistake on that one -- you essentially looked at outdated documentation (for some reason, I updated everything except the store docs).

I've updated the relevant sections in the site, and sharing the updated jsfiddle link below:

One thing that you may have noticed is that if you're familiar with other store implementations, it's now less like zustand and more similar to a mix of express/redux. I just found that in the production application that I'm working on, it's a lot more manageable with this new API.

In general, my folder structure looks like this:

elements/
  ├── elementName1
  ├── elementName2
  └── etc
index.js (this contains all the actions or .register calls)
store.js

I plan to write more about the architecture about non-trivial applications once I launch the production app that uses Cami (by June 2024)

from cami.js.

Related Issues (3)

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.