MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / updateState

Function updateState

src/canvas/widgets/base.js:290–312  ·  view source on GitHub ↗

* This function will notify the canvas of the updates to the widgets * * @param {} newState - this can either be a callback or a new State like (prevState) => ({key: value}) * @param {*} callback - callback to run after setState

(newState, callback)

Source from the content-addressed store, hash-verified

288 * @param {*} callback - callback to run after setState
289 */
290 updateState(newState, callback){
291 // console.trace("Callback trace");
292 // debugger;
293
294 // FIXME: maximum recursion error when updating size, color etc
295 this.setState(newState, () => {
296 // console.log("updatinhg./..: ", this.state, newState)
297
298 const { onWidgetUpdate } = this.props
299
300
301 if (this.stateUpdateCallback)
302 this.stateUpdateCallback()
303
304 // FIXME: super inefficient
305 // if (onWidgetUpdate) {
306 // onWidgetUpdate(this.__id)
307 // }
308
309 if (callback) callback()
310
311 })
312 }
313
314 _getWidgetMethods = () => {
315 return {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected