Coder Social home page Coder Social logo

Comments (12)

soininen avatar soininen commented on June 25, 2024 1

It's about a TempId not being resolved to real id in Toolbox side. Using TempIdDict in entity tree items fixes the issue. I need to still figure out why the corresponding unit test fails - perhaps it needs to wait for the pending changes to take place. The unit test is fixed now as well.

from spine-toolbox.

soininen avatar soininen commented on June 25, 2024 1

@manuelma How about we never change the client-side id, not even when the item is committed? The db map could store the real id in the cache item or keep a lookup table on client id <--> real id transformations. This way we wouldn't need to notify clients at all. Well, that's just one idea. In any case, I'm still undecided what to think about the TempIdDict stuff.

What I'm sure of is that we should stop hijacking this issue's discussion :)

from spine-toolbox.

manuelma avatar manuelma commented on June 25, 2024 1

I would like to give this one a try @soininen @PiispaH - I believe there is an easy way to implement @soininen 's idea and get rid of the TempIdDict.

from spine-toolbox.

soininen avatar soininen commented on June 25, 2024

I ran into similar issue while fixing unit tests under #2294.

from spine-toolbox.

manuelma avatar manuelma commented on June 25, 2024

Thanks for reporting and please let me know if you need help understanding the new code. Committing has changed considerably so I am not surprised to see something like this...

from spine-toolbox.

soininen avatar soininen commented on June 25, 2024

Hopefully the above commit fixes this.

from spine-toolbox.

manuelma avatar manuelma commented on June 25, 2024

Very nice catch @soininen

I am thinking that something like this can also affect the parameter tables and maybe the pivot table, and basically every Qt model where we store DB ids. It makes me wonder... The TempId approach is nice in the sense it removes the need to access the DB for creating new items, but at the same time it might be a bit too crazy.

What worries me is clients will need to import and use this TempIdDict guy everytime they'd want to develop something that stores DB ids... Maybe we need to think about this more... Maybe I can present the issue in the next dev meeting and we can all brainstorm...

from spine-toolbox.

PiispaH avatar PiispaH commented on June 25, 2024

This issue still seems to persist for me if the db editor session is not refreshed between adding the items and deleting them.

from spine-toolbox.

soininen avatar soininen commented on June 25, 2024

Looks like I fixed this only for the Entity tree and not for Parameter value table.

from spine-toolbox.

manuelma avatar manuelma commented on June 25, 2024

Every Qt model must be affected by this, because we store DB ids in their internal data structure. We need to use a TempIdDict everywhere instead (and I don't know how will that work for the parameter tables where the id is stored in a list rather than a dict). I like @soininen 's idea about never resolving ids and instead keeping a mapping from real-id to temp-id somewhere in DatabaseMapping or DBCacheBase...?

from spine-toolbox.

soininen avatar soininen commented on June 25, 2024

@manuelma Sure, please go ahead! I got distracted and am currently bogged down with some other stuff.

from spine-toolbox.

manuelma avatar manuelma commented on June 25, 2024

I think it got solved, will close again...

from spine-toolbox.

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.