Add safe check so collab stats dont show up for host apps
This commit is contained in:
parent
5644063fc7
commit
98c16659c9
@ -207,6 +207,9 @@ const gesture: Gesture = {
|
||||
initialScale: null,
|
||||
};
|
||||
|
||||
const shouldEnableNetworkStats = !!(
|
||||
typeof process !== "undefined" && process.env?.REACT_APP_SOCKET_SERVER_URL
|
||||
);
|
||||
export type PointerDownState = Readonly<{
|
||||
// The first position at which pointerDown happened
|
||||
origin: Readonly<{ x: number; y: number }>;
|
||||
@ -474,6 +477,7 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
||||
elements={this.scene.getElements()}
|
||||
onClose={this.toggleStats}
|
||||
isCollaborating={this.props.isCollaborating}
|
||||
shouldEnableNetworkStats={shouldEnableNetworkStats}
|
||||
/>
|
||||
)}
|
||||
{this.state.toastMessage !== null && (
|
||||
@ -881,8 +885,9 @@ class App extends React.Component<ExcalidrawProps, AppState> {
|
||||
});
|
||||
}
|
||||
if (
|
||||
prevState.showStats !== this.state.showStats ||
|
||||
prevProps.isCollaborating !== this.props.isCollaborating
|
||||
shouldEnableNetworkStats &&
|
||||
(prevState.showStats !== this.state.showStats ||
|
||||
prevProps.isCollaborating !== this.props.isCollaborating)
|
||||
) {
|
||||
const navigator: Navigator & {
|
||||
connection?: {
|
||||
|
@ -37,6 +37,7 @@ export const Stats = (props: {
|
||||
elements: readonly NonDeletedExcalidrawElement[];
|
||||
onClose: () => void;
|
||||
isCollaborating?: boolean;
|
||||
shouldEnableNetworkStats: boolean;
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
const [storageSizes, setStorageSizes] = useState<StorageSizes>({
|
||||
@ -177,7 +178,7 @@ export const Stats = (props: {
|
||||
</td>
|
||||
</tr>
|
||||
)}
|
||||
{props.isCollaborating ? (
|
||||
{props.shouldEnableNetworkStats && props.isCollaborating ? (
|
||||
<>
|
||||
<tr>
|
||||
<th colSpan={2}>{t("stats.collaboration")}</th>
|
||||
|
Loading…
x
Reference in New Issue
Block a user