[4.2] Persistent callbacks#3771
Open
T4rk1n wants to merge 8 commits into
Open
Conversation
camdecoster
reviewed
May 12, 2026
Contributor
camdecoster
left a comment
There was a problem hiding this comment.
I left a few comments, but this is looking good.
Comment on lines
+113
to
+130
| const noOutputCallbacks = (graphs.callbacks || []) | ||
| .filter(cb => cb.noOutput && !cb.prevent_initial_call) | ||
| .map(cb => { | ||
| const resolved = makeResolvedCallback(cb, resolveDeps(), ''); | ||
| resolved.initialCall = true; | ||
| return resolved; | ||
| }) | ||
| .filter(cb => { | ||
| // If no inputs, always include (fires once on initial load) | ||
| if (cb.callback.inputs.length === 0) { | ||
| return true; | ||
| } | ||
| // Check if any input is in the layout | ||
| const inputs = cb.getInputs(paths); | ||
| return inputs.some(inp => | ||
| Array.isArray(inp) ? inp.length > 0 : inp | ||
| ); | ||
| }); |
Contributor
There was a problem hiding this comment.
You iterate through the callbacks three times. What do you think of switching to a for...of loop that does everything in one pass? In fact, you could use one loop that handles both noOutputCallbacks and noInputCallbacks.
Comment on lines
+180
to
+181
| # Fallback to empty hash if no external frame found | ||
| return _hash_inputs() |
Contributor
There was a problem hiding this comment.
Suggested change
| # Fallback to empty hash if no external frame found | |
| return _hash_inputs() |
| # Get the call site of the @callback decorator | ||
| stack = inspect.stack() | ||
| # Walk up the stack to find the actual callback call site | ||
| # (skip internal dash package frames) |
Contributor
There was a problem hiding this comment.
Suggested change
| # (skip internal dash package frames) | |
| # Fallback to empty hash if no external frame found | |
| # (skip internal dash package frames) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds support for:
Examples
Persistent callback without inputs/outputs
No-input callback (fires on initial load)
No-input no-output callback (side-effect only)