MCPcopy
hub / github.com/StructuredLabs/preswald / should_render

Method should_render

preswald/engine/utils.py:218–223  ·  view source on GitHub ↗

High-level API to check whether a component should rerender. Updates the cache if the value has changed.

(self, component_id: str, new_value: Any)

Source from the content-addressed store, hash-verified

216 self._state_cache[component_id] = self._ensure_hash(new_value)
217
218 def should_render(self, component_id: str, new_value: Any) -> bool:
219 """
220 High-level API to check whether a component should rerender.
221 Updates the cache if the value has changed.
222 """
223 return self._update_if_changed(component_id, new_value)
224
225 def _ensure_hash(self, value: Any) -> str:
226 """Convert value to SHA256 hash. Accepts either a hash string or a hashable object."""

Callers 1

wrapperFunction · 0.45

Calls 1

_update_if_changedMethod · 0.95

Tested by

no test coverage detected