Giter Club home page Giter Club logo

Comments (3)

jacomyal avatar jacomyal commented on June 2, 2024

Just a short reminder, I need to know more :)

from domino.js.

jacomyma avatar jacomyma commented on June 2, 2024

(...continuation)
Ok, so the issue is that I have a list and I need to update only certain elements, or even a single element. For now I just write the whole process in the 'success' function of the service querying these elements to update. I imagine that we could have a way to do it without editing a success function.

We do not need to edit a success function when we update a single property, because we have the path. I would like the same type of helper to just update a single element in a list. Honestly I'm not sure this is a better solution than a custom success function, but maybe you have an idea... The fact is that I (almost) always write the same thing in my success functions. The process is typically:

  • get the id of the element (or list of ids)
  • update the element(s) that have this id
  • trigger an update event on the list
  • trigger update events for the updated elements, with the id as data linked to each event (not always)

The same way, it may be possible to have an index for my elements. In my previous example, I have a "jobs_byId" property, in order to retrieve easily an element. Here is a suggestion but there are other solutions:

  • having a "indexed-list" type of property. Ex: I declare the "jobs" property with type "indexed-list"
  • services have an 'updater' feature, similar to the setter feature, but dedicated to updating an indexed-list. Ex: my service 'getJob' has a 'updater' to 'jobs' (and a path) so that the job is updated in the list. Of course I also have a service 'getAllJobs' has a setter to 'jobs', because in this case I want to reset the whole list
  • when the a 'indexed-list' property is updated, its index is updated also. Both are always linked.
  • we just need to know how to retrieve an id inside the objects of the list. This coud be a property of the property (!). Ex: 'jobs' has a property 'id-path': 'id' or a function 'retreive-id': function(obj){return obj.id]

Maybe this can be done with shortcuts, but I do not understand how to do it.

from domino.js.

jacomyal avatar jacomyal commented on June 2, 2024

We have done nothing yet about this in the new version (see the reboot-proposal branch to know more).

I'll try to take this into account before releasing it.

from domino.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.