Giter Club home page Giter Club logo

Comments (2)

mbostock avatar mbostock commented on May 12, 2024

I am guessing you don’t mean a literal infinite loop here (that hangs the browser and causes the blue tab of death). You mean that the transition never ends and so the tween is called every tick with t = 1, even though the transition should have ended immediately after the first tick with t = 1.

I guess it would be reasonable to ensure that the transition ends even if an error is thrown on end. Just have to be careful where we put the try-finally for optimization reasons and to preserve the existing state (the transition state is not cleared until after the transition ends).

from d3-transition.

mbostock avatar mbostock commented on May 12, 2024

Confirmed that this is not an infinite loop (and that the transition doesn’t end):

http://bl.ocks.org/mbostock/93b26626ac948365fe8efb3ff054c204

Related d3/d3#2415. From a quick read-through of the code, there are potentially a bunch of issues here, though some of the following behaviors may be reasonable:

  1. If an error is thrown by an interrupt event listener when a transition starts, the interrupted transition is never cleaned up and the starting transition never starts.
  2. If an error is thrown by a start event listener, the transition does not finish starting nor is it cleaned up.
  3. If a tween throws an error on start, subsequent tweens are never initialized and will not be invoked for the duration of the transition.
  4. If a tween throws an error on tick, subsequent tweens are not invoked for that tick (nor are subsequent timers).
  5. If a tween throws an error on the last tick, the transition does not finish ending and is not cleaned up.
  6. If an error is thrown by an end event listener, the transition is not cleaned up.

I don’t think the answer is to wrap every listener and tween invocation if a try block, but I do think we can probably define better behavior when errors are thrown.

from d3-transition.

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.