MCPcopy Create free account
hub / github.com/tinyplex/tinybase / handleJsonThingChange

Function handleJsonThingChange

src/ui-solid-dom/common/components.tsx:190–207  ·  view source on GitHub ↗
(
    value: string,
    setTypedThing: (value: string) => void,
    isThing: (thing: any) => boolean,
    setTypedClassName: (className: string) => void,
  )

Source from the content-addressed store, hash-verified

188 };
189
190 const handleJsonThingChange = (
191 value: string,
192 setTypedThing: (value: string) => void,
193 isThing: (thing: any) => boolean,
194 setTypedClassName: (className: string) => void,
195 ) => {
196 setTypedThing(value);
197 try {
198 const object = jsonParse(value);
199 if (isThing(object)) {
200 setCurrentThing(() => object);
201 props.onThingChange(object);
202 setTypedClassName('');
203 }
204 } catch {
205 setTypedClassName('invalid');
206 }
207 };
208
209 const handleTypeChange = () => {
210 if (!props.hasSchema?.()) {

Callers 2

widgetFunction · 0.70
EditableThingFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…