MCPcopy Index your code
hub / github.com/plotly/dash / _initial_output

Method _initial_output

dash/mcp/primitives/tools/callback_adapter.py:180–206  ·  view source on GitHub ↗

Run this callback with initial input values. Returns the ``response`` portion of the callback result: ``{component_id: {property: value}}``. Skipped for callbacks with ``prevent_initial_call=True``, matching how the Dash renderer skips them on page load.

(self)

Source from the content-addressed store, hash-verified

178
179 @cached_property
180 def _initial_output(self) -> dict[str, CallbackOutput]:
181 """Run this callback with initial input values.
182
183 Returns the ``response`` portion of the callback result:
184 ``{component_id: {property: value}}``.
185
186 Skipped for callbacks with ``prevent_initial_call=True``,
187 matching how the Dash renderer skips them on page load.
188 """
189 if self.prevents_initial_call:
190 return {}
191
192 callback_map = get_app().mcp_callback_map
193 kwargs = {}
194 for p in self.inputs:
195 upstream = callback_map.find_by_output(p["id_and_prop"])
196 if upstream is self:
197 kwargs[p["name"]] = getattr(
198 find_component(p["component_id"]), p["property"], None
199 )
200 else:
201 kwargs[p["name"]] = callback_map.get_initial_value(p["id_and_prop"])
202 try:
203 result = run_callback(self, kwargs)
204 return result.get("response", {})
205 except Exception: # pylint: disable=broad-exception-caught
206 return {}
207
208 def initial_output_value(self, id_and_prop: str) -> Any:
209 """Return the initial value for a specific output ``"component_id.property"``."""

Callers

nothing calls this directly

Calls 6

get_appFunction · 0.90
find_componentFunction · 0.90
find_by_outputMethod · 0.80
get_initial_valueMethod · 0.80
run_callbackFunction · 0.70
getMethod · 0.45

Tested by

no test coverage detected