mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-26 11:38:37 +00:00
Apply strictNullChecks to src/async-components/* (#10251
* Apply strictNullChecks to src/async-components/* * Iterate
This commit is contained in:
committed by
GitHub
parent
629e5cb01f
commit
8ad21e6492
@@ -38,7 +38,7 @@ interface IState {
|
||||
eventCount: number;
|
||||
crawlingRoomsCount: number;
|
||||
roomCount: number;
|
||||
currentRoom: string;
|
||||
currentRoom: string | null;
|
||||
crawlerSleepTime: number;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,8 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
|
||||
public updateCurrentRoom = async (room: Room): Promise<void> => {
|
||||
const eventIndex = EventIndexPeg.get();
|
||||
let stats: IIndexStats;
|
||||
if (!eventIndex) return;
|
||||
let stats: IIndexStats | undefined;
|
||||
|
||||
try {
|
||||
stats = await eventIndex.getStats();
|
||||
@@ -71,7 +72,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
return;
|
||||
}
|
||||
|
||||
let currentRoom = null;
|
||||
let currentRoom: string | null = null;
|
||||
|
||||
if (room) currentRoom = room.name;
|
||||
const roomStats = eventIndex.crawlingRooms();
|
||||
@@ -79,8 +80,8 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
const roomCount = roomStats.totalRooms.size;
|
||||
|
||||
this.setState({
|
||||
eventIndexSize: stats.size,
|
||||
eventCount: stats.eventCount,
|
||||
eventIndexSize: stats?.size ?? 0,
|
||||
eventCount: stats?.eventCount ?? 0,
|
||||
crawlingRoomsCount: crawlingRoomsCount,
|
||||
roomCount: roomCount,
|
||||
currentRoom: currentRoom,
|
||||
@@ -100,7 +101,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
let crawlingRoomsCount = 0;
|
||||
let roomCount = 0;
|
||||
let eventCount = 0;
|
||||
let currentRoom = null;
|
||||
let currentRoom: string | null = null;
|
||||
|
||||
const eventIndex = EventIndexPeg.get();
|
||||
|
||||
@@ -109,8 +110,10 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
|
||||
try {
|
||||
const stats = await eventIndex.getStats();
|
||||
eventIndexSize = stats.size;
|
||||
eventCount = stats.eventCount;
|
||||
if (stats) {
|
||||
eventIndexSize = stats.size;
|
||||
eventCount = stats.eventCount;
|
||||
}
|
||||
} catch {
|
||||
// This call may fail if sporadically, not a huge issue as we
|
||||
// will try later again in the updateCurrentRoom call and
|
||||
@@ -136,7 +139,7 @@ export default class ManageEventIndexDialog extends React.Component<IProps, ISta
|
||||
|
||||
private onDisable = async (): Promise<void> => {
|
||||
const DisableEventIndexDialog = (await import("./DisableEventIndexDialog")).default;
|
||||
Modal.createDialog(DisableEventIndexDialog, null, null, /* priority = */ false, /* static = */ true);
|
||||
Modal.createDialog(DisableEventIndexDialog, undefined, undefined, /* priority = */ false, /* static = */ true);
|
||||
};
|
||||
|
||||
private onCrawlerSleepTimeChange = (e: ChangeEvent<HTMLInputElement>): void => {
|
||||
|
||||
Reference in New Issue
Block a user