Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions dash/_callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
from . import _validate
from .background_callback.managers import BaseBackgroundCallbackManager
from ._callback_context import context_value
from ._no_update import NoUpdate


async def _async_invoke_callback(
Expand All @@ -58,17 +59,6 @@ def _invoke_callback(func, *args, **kwargs): # used to mark the frame for the d
return func(*args, **kwargs) # %% callback invoked %%


class NoUpdate:
def to_plotly_json(self): # pylint: disable=no-self-use
return {"_dash_no_update": "_dash_no_update"}

@staticmethod
def is_no_update(obj):
return isinstance(obj, NoUpdate) or (
isinstance(obj, dict) and obj == {"_dash_no_update": "_dash_no_update"}
)


GLOBAL_CALLBACK_LIST = []
GLOBAL_CALLBACK_MAP = {}
GLOBAL_INLINE_SCRIPTS = []
Expand Down
9 changes: 9 additions & 0 deletions dash/_no_update.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
class NoUpdate:
def to_plotly_json(self): # pylint: disable=no-self-use
return {"_dash_no_update": "_dash_no_update"}

@staticmethod
def is_no_update(obj):
return isinstance(obj, NoUpdate) or (
isinstance(obj, dict) and obj == {"_dash_no_update": "_dash_no_update"}
)
5 changes: 3 additions & 2 deletions dash/_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import flask

from ._grouping import grouping_len, map_grouping
from ._no_update import NoUpdate
from .development.base_component import Component
from . import exceptions
from ._utils import (
Expand Down Expand Up @@ -211,8 +212,8 @@ def validate_multi_return(output_lists, output_values, callback_id):


def fail_callback_output(output_value, output):
valid_children = (str, int, float, type(None), Component)
valid_props = (str, int, float, type(None), tuple, MutableSequence)
valid_children = (str, int, float, type(None), Component, NoUpdate)
valid_props = (str, int, float, type(None), tuple, MutableSequence, NoUpdate)

def _raise_invalid(bad_val, outer_val, path, index=None, toplevel=False):
bad_type = type(bad_val).__name__
Expand Down