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)
| 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"``.""" |
nothing calls this directly
no test coverage detected