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