Code Monkey home page Code Monkey logo

Comments (4)

kumilingus avatar kumilingus commented on June 17, 2024

The problem with this approach is that hashmap keys don't have a guaranteed order, which means that this code is most probably missing the textHash / cache most often than not.

The order is indeed not guaranteed.

In my experience, browsers return the same string for the same object instance (and for objects whose properties were created in the same order - which is JointJS case).

So even though in theory there are inaccuracies, in practice it works well enough. This caching should prevent the same text from being rendered on every update. And I do believe it does.

Do you have any example where the cache is missed?

from joint.

kumilingus avatar kumilingus commented on June 17, 2024

Looking at the code, it would be relatively easy to store the text attributes one by one in a variable instead of using the util.pick method. I'm just trying to guess how critical this problem is.

from joint.

alexandernst avatar alexandernst commented on June 17, 2024

Hey! It's not critical at all. In fact, worst case scenario the cache will be missed and the text will be rerendered. I can't create a demo that will reproduce the bug. It did happened to me a couple of times (in the span of a week), but it's very random.

from joint.

kumilingus avatar kumilingus commented on June 17, 2024

Fixed in #2333.

from joint.

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.