Apply strictNullChecks
to src/components/views/elements/*
(#10462
* Apply `strictNullChecks` to `src/components/views/elements/*` * Iterate * Iterate * Iterate * Apply `strictNullChecks` to `src/components/views/elements/*` * Iterate * Iterate * Iterate * Update snapshot
This commit is contained in:
parent
cefd94859c
commit
a47b3eb0ee
24 changed files with 158 additions and 121 deletions
|
@ -40,7 +40,7 @@ interface IProps {
|
|||
interface IState {
|
||||
roomMember: RoomMember;
|
||||
isWrapped: boolean;
|
||||
widgetDomain: string;
|
||||
widgetDomain: string | null;
|
||||
}
|
||||
|
||||
export default class AppPermission extends React.Component<IProps, IState> {
|
||||
|
@ -66,14 +66,14 @@ export default class AppPermission extends React.Component<IProps, IState> {
|
|||
};
|
||||
}
|
||||
|
||||
private parseWidgetUrl(): { isWrapped: boolean; widgetDomain: string } {
|
||||
private parseWidgetUrl(): { isWrapped: boolean; widgetDomain: string | null } {
|
||||
const widgetUrl = url.parse(this.props.url);
|
||||
const params = new URLSearchParams(widgetUrl.search);
|
||||
const params = new URLSearchParams(widgetUrl.search ?? undefined);
|
||||
|
||||
// HACK: We're relying on the query params when we should be relying on the widget's `data`.
|
||||
// This is a workaround for Scalar.
|
||||
if (WidgetUtils.isScalarUrl(this.props.url) && params && params.get("url")) {
|
||||
const unwrappedUrl = url.parse(params.get("url"));
|
||||
if (WidgetUtils.isScalarUrl(this.props.url) && params?.get("url")) {
|
||||
const unwrappedUrl = url.parse(params.get("url")!);
|
||||
return {
|
||||
widgetDomain: unwrappedUrl.host || unwrappedUrl.hostname,
|
||||
isWrapped: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue