| 251 | } |
| 252 | |
| 253 | export class App extends PureComponent<Props, State> { |
| 254 | private readonly endpoints: StreamlitEndpoints |
| 255 | |
| 256 | private readonly sessionInfo = new SessionInfo() |
| 257 | |
| 258 | private readonly metricsMgr = new MetricsManager(this.sessionInfo) |
| 259 | |
| 260 | private readonly sessionEventDispatcher = new SessionEventDispatcher() |
| 261 | |
| 262 | private connectionManager: ConnectionManager | null |
| 263 | |
| 264 | private readonly widgetMgr: WidgetStateManager |
| 265 | |
| 266 | private readonly hostCommunicationMgr: HostCommunicationManager |
| 267 | |
| 268 | private readonly uploadClient: FileUploadClient |
| 269 | |
| 270 | private readonly componentRegistry: ComponentRegistry |
| 271 | |
| 272 | private readonly embeddingId: string = generateUID() |
| 273 | |
| 274 | /** |
| 275 | * Ref to the root app container element. |
| 276 | * Used by components like Sidebar to detect clicks inside/outside the app. |
| 277 | */ |
| 278 | private readonly appRootRef = createRef<HTMLDivElement>() |
| 279 | |
| 280 | /** Client for backend operation requests (lazy loading, validation, etc.) */ |
| 281 | private readonly backendOperationClient: BackendOperationClient |
| 282 | |
| 283 | private readonly appNavigation: AppNavigation |
| 284 | |
| 285 | private isInitializingConnectionManager: boolean = true |
| 286 | |
| 287 | // Whether we have received a NewSession message after the latest rerun request. |
| 288 | // This is used to ensure that we only increment the message cache run count after |
| 289 | // we have received a NewSession message after the latest rerun request. |
| 290 | // This will allow us to ignore finished messages from previous script runs. |
| 291 | private hasReceivedNewSession: boolean = false |
| 292 | |
| 293 | public constructor(props: Props) { |
| 294 | super(props) |
| 295 | |
| 296 | // Register hotkey filter: |
| 297 | ensureHotkeysFilterConfigured() |
| 298 | |
| 299 | // Initialize immerjs |
| 300 | enablePatches() |
| 301 | enableMapSet() |
| 302 | |
| 303 | this.state = { |
| 304 | connectionState: ConnectionState.INITIAL, |
| 305 | elements: AppRoot.empty("", true), // Blank Main Script Hash for initial render |
| 306 | isFullScreen: false, |
| 307 | scriptName: "", |
| 308 | scriptRunId: INITIAL_SCRIPT_RUN_ID, |
| 309 | appHash: null, |
| 310 | scriptRunState: ScriptRunState.NOT_RUNNING, |
nothing calls this directly
no test coverage detected