More Features
Overview
Available since io.Connect Browser 5.0
When a Global Layout or a Workspace is restored, some of the apps saved in it may no longer be available - e.g., if the user permissions have changed, or if the app definitions have been removed or renamed. io.Connect Browser displays the Placeholder App instead of each missing app. The Placeholder App informs the user which app couldn't be loaded, occupies the position of the missing app, and preserves the structure of the Workspace.
When a Layout containing a placeholder app is saved, the original app information is retained in it so that the original app can be restored when it becomes available again. This allows users to save changes to the arrangement without replacing the missing app with the placeholder in the saved Layout.
Custom Placeholder App
Available since io.Connect Browser 5.0 & @interopio/components-react 5.0
The Placeholder App is named io-connect-placeholder-app. To use a custom placeholder app, provide an app definition with this name and the URL of your app.
The following example demonstrates providing the app definition when initializing the Main app:
import IOBrowserPlatform from "@interopio/browser-platform";
const config = {
licenseKey: "my-license-key",
applications: {
local: [
{
name: "io-connect-placeholder-app",
title: "My Placeholder App",
type: "window",
hidden: true,
details: {
url: "https://my-placeholder-app.com"
}
}
]
}
};
const { io } = await IOBrowserPlatform(config);The placeholder receives information about the missing app in the originalApp property of its startup context, including its name, type, and saved context. If a deployment doesn't define a placeholder app, unavailable apps will be skipped instead of causing the entire Layout restore to fail.
The components of the default Placeholder App are available via the IOPlaceholderApp object of the @interopio/components-react library. Use its <PlaceholderAppPage /> component to build a custom placeholder app. You can replace or remove the <Header /> and <SupportPanel /> components of the page via the components property. Use the usePlaceholderAppStartupContext() hook to retrieve the details about the missing app.
The following example demonstrates creating a placeholder app with a custom header and without the support panel:
import { IOConnectProvider } from "@interopio/react-hooks";
import IOBrowser from "@interopio/browser";
import { IOPlaceholderApp, ThemeProvider } from "@interopio/components-react";
import "@interopio/components-react/dist/styles/features/placeholder-app/styles.css";
const {
PlaceholderAppPage,
Header,
usePlaceholderAppStartupContext
} = IOPlaceholderApp;
// Custom header showing the name of the missing app.
const CustomHeader = () => {
const appName = usePlaceholderAppStartupContext().originalApp.name;
return <Header title="App Unavailable" message={`${appName} isn't available. Please, contact your administrator.`} />;
};
const App = () => {
return (
<IOConnectProvider settings={{ browser: { factory: IOBrowser } }}>
<ThemeProvider>
<PlaceholderAppPage components={{ Header: CustomHeader, SupportPanel: undefined }} />
</ThemeProvider>
</IOConnectProvider>
);
};
export default App;Styles
To customize the styles of the Placeholder App, use the CSS variables provided by the @interopio/components-react library.