MCPcopy
hub / github.com/streamlit/streamlit / removeInactiveWidgetState

Method removeInactiveWidgetState

frontend/app/src/App.tsx:1696–1705  ·  view source on GitHub ↗

* Remove widget and element state for items no longer present in the * current render tree. Called from setState callbacks where this.state * access is a false positive (the callback runs after the update is * committed). Converting App to a functional component would let us * use useEff

()

Source from the content-addressed store, hash-verified

1694 * use useEffect and remove this suppress entirely.
1695 */
1696 private removeInactiveWidgetState(): void {
1697 const { elements, blockIds } = this.state.elements.getActiveIds()
1698 const activeIds = new Set([
1699 ...Array.from(elements)
1700 .map(element => getElementId(element))
1701 .filter(notUndefined),
1702 ...blockIds,
1703 ])
1704 this.widgetMgr.removeInactive(activeIds)
1705 }
1706
1707 /**
1708 * Opens a dialog with the specified state.

Callers 2

handleScriptFinishedMethod · 0.95
clearAppStateMethod · 0.95

Calls 4

getElementIdFunction · 0.90
getActiveIdsMethod · 0.80
mapMethod · 0.80
removeInactiveMethod · 0.45

Tested by

no test coverage detected