Drop ErrorView's widget prop in favour of the host bridge

ErrorView needed a widget only to decide whether to offer a close button
or a link home. That prop was threaded down through ErrorPage, RichError
and GroupCallErrorBoundary from seven call sites, to answer the single
question of whether the host can dismiss Element Call — which the host
bridge now answers directly through the presence of close().

Read the bridge from context in ErrorView and remove the prop, along with
the plumbing that carried it.

No functional change: the rendered output is unchanged, as the existing
snapshot confirms.

Move GroupCallView onto the host bridge

GroupCallView asked the widget API to keep it on screen, to close it, and
to tell it when a preloaded call should join. Route all three through the
host bridge and drop the widget prop.
This commit is contained in:
Valere
2026-09-02 13:03:23 +02:00
parent d8d70812b8
commit 8e78ac76bd
18 changed files with 542 additions and 365 deletions
+28 -15
View File
@@ -33,6 +33,12 @@ import {
import { AppBar } from "./AppBar";
import { i18n } from "./utils/i18n";
import { useRootElement } from "./RootElementContext";
import {
createWidgetHostBridge,
HostBridgeProvider,
nullHostBridge,
} from "./HostBridge";
import { useInitial } from "./useInitial";
const SentryRoute = Sentry.withSentryReactRouterV7Routing(Route);
@@ -78,13 +84,18 @@ interface Props {
}
export const App: FC<Props> = ({ vm }) => {
// The standalone build has no host; the widget build's host is the client it
// is a widget of.
const hostBridge = useInitial(() =>
widget === null ? nullHostBridge : createWidgetHostBridge(widget),
);
const [loaded, setLoaded] = useState(false);
useEffect(() => {
Initializer.init()
?.then(async () => {
if (loaded) return;
setLoaded(true);
await widget?.api.sendContentLoaded();
await hostBridge.contentLoaded();
})
.catch(logger.error);
});
@@ -94,7 +105,7 @@ export const App: FC<Props> = ({ vm }) => {
<MediaDevicesContext value={vm.mediaDevices}>
<ProcessorProvider>
<Sentry.ErrorBoundary
fallback={(error) => <ErrorPage error={error} widget={widget} />}
fallback={(error) => <ErrorPage error={error} />}
>
<Routes>
<SentryRoute path="/" element={<HomePage />} />
@@ -112,19 +123,21 @@ export const App: FC<Props> = ({ vm }) => {
return (
<I18nextProvider i18n={i18n}>
<BrowserRouter>
<LocationUrlParamsProvider>
<BackgroundProvider>
<ThemeProvider>
<TooltipProvider>
<Suspense fallback={null}>
<MaybeAppBar>{content}</MaybeAppBar>
</Suspense>
</TooltipProvider>
</ThemeProvider>
</BackgroundProvider>
</LocationUrlParamsProvider>
</BrowserRouter>
<HostBridgeProvider value={hostBridge}>
<BrowserRouter>
<LocationUrlParamsProvider>
<BackgroundProvider>
<ThemeProvider>
<TooltipProvider>
<Suspense fallback={null}>
<MaybeAppBar>{content}</MaybeAppBar>
</Suspense>
</TooltipProvider>
</ThemeProvider>
</BackgroundProvider>
</LocationUrlParamsProvider>
</BrowserRouter>
</HostBridgeProvider>
</I18nextProvider>
);
};