plotly / plotly/dash

Allow disabling circular callback check

Open
#2,143 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P3
Dominant language
Python
Stars
24.4k
Forks
2.3k
Avg merge
2d 7h
Merged PRs (30d)
13

Description

First of all, thank you for Plotly and Dash. They are both very useful and amazing pieces of software and I appreciate the hard work.

I have a feature request that's related to #2139 but it isn't exactly the same thing. I don't actually need the ability to enable circular callbacks. However, I'd like the ability to disable the runtime checks in JS that check if circular callbacks exist.

I work on a moderately complex Dash app and it has a large number of callbacks. The initial page load (the time taken for the Loading ... text to disappear and be replaced by the app layout) can take in the order of seconds. I was debugging the issue with Chrome when I noticed the function addDependency taking a lot of time. See the screenshot below:

image

I am assuming the call to addDependency() corresponds to this snippet here: https://github.com/plotly/dash/blob/dev/dash/dash-renderer/src/actions/dependencies.js#L772

    function addInputToMulti(inIdProp, outIdProp, firstPass = true) {
        multiGraph.addNode(inIdProp);
        multiGraph.addDependency(inIdProp, outIdProp);
        // only store callback inputs and outputs during the first pass
        if (firstPass) {
            cbIn[cbIn.length - 1].push(inIdProp);
            cbOut[cbOut.length - 1].push(outIdProp);
        }
    }

Since multiGraph is used only for checking circular dependencies, I commented out the addNode() and addDependency()
lines and tried the app again. This time, it loaded in a fraction of the original time:

image

Would it be possible to have a flag to disable the runtime circular callback checks? Alternatively, would it be possible to do this check at the server side just once, when the server loads? Finally, assuming I make sure to never have circular callbacks, are there any downsides to disabling these checks in a local fork of Dash?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in dash/dash-renderer/src/actions/dependencies.js around addInputToMulti and the referenced addDependency call. Trace how multiGraph is used for circular callback checks, then define what a disable-check flag should affect and verify that callback dependency processing still completes when the checks are skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, python
Domain
frontend, performance
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.