(props: Props)
| 134 | private readonly componentRegistry: ComponentRegistry |
| 135 | |
| 136 | public constructor(props: Props) { |
| 137 | super(props) |
| 138 | |
| 139 | // Initialize managers |
| 140 | this.widgetMgr = new WidgetStateManager({ |
| 141 | sendRerunBackMsg: this.sendRerunBackMsg, |
| 142 | formsDataChanged: formsData => this.setState({ formsData }), |
| 143 | }) |
| 144 | |
| 145 | this.componentRegistry = new ComponentRegistry(this.endpoints) |
| 146 | |
| 147 | this.uploadClient = new FileUploadClient({ |
| 148 | sessionInfo: this.sessionInfo, |
| 149 | endpoints: this.endpoints, |
| 150 | // A form cannot be submitted if it contains a FileUploader widget |
| 151 | // that's currently uploading. We write that state here, in response |
| 152 | // to a FileUploadClient callback. The FormSubmitButton element |
| 153 | // reads the state. |
| 154 | formsWithPendingRequestsChanged: formIds => |
| 155 | this.widgetMgr.setFormsWithUploadsInProgress(formIds), |
| 156 | requestFileURLs: vi.fn(), |
| 157 | }) |
| 158 | |
| 159 | this.sessionInfo.setCurrent({ |
| 160 | // Disable ForwardMessageCaching: |
| 161 | maxCachedMessageAge: 0, |
| 162 | |
| 163 | // Used by FileUploadClient to associate file uploads with |
| 164 | // sessions. |
| 165 | sessionId: "mockSessionId", |
| 166 | |
| 167 | // Unused by StreamlitLib: |
| 168 | appId: "", |
| 169 | streamlitVersion: "", |
| 170 | pythonVersion: "", |
| 171 | serverOS: "", |
| 172 | hasDisplay: true, |
| 173 | installationId: "", |
| 174 | installationIdV3: "", |
| 175 | installationIdV4: "", |
| 176 | commandLine: "", |
| 177 | isHello: false, |
| 178 | isConnected: true, |
| 179 | }) |
| 180 | |
| 181 | // Initialize React state |
| 182 | this.state = { |
| 183 | elements: AppRoot.empty(""), |
| 184 | formsData: createFormsData(), |
| 185 | scriptRunState: ScriptRunState.NOT_RUNNING, |
| 186 | // ScriptRunID should get a new unique ID every time the |
| 187 | // Streamlit view is being "rebuilt". |
| 188 | scriptRunId: `${0}`, |
| 189 | } |
| 190 | } |
| 191 | |
| 192 | /** |
| 193 | * Should be called before the first Delta from a "script run" is handled. |
nothing calls this directly
no test coverage detected