|
@@ -1,5 +1,6 @@
|
|
|
import React, { useCallback, useMemo } from 'react';
|
|
import React, { useCallback, useMemo } from 'react';
|
|
|
|
|
|
|
|
|
|
+import { pagePathUtils } from '@growi/core';
|
|
|
|
|
|
|
|
import { useSWRxNodeTree } from '../stores/lsx';
|
|
import { useSWRxNodeTree } from '../stores/lsx';
|
|
|
|
|
|
|
@@ -37,7 +38,10 @@ export const Lsx = React.memo(({
|
|
|
return new LsxContext(prefix, options);
|
|
return new LsxContext(prefix, options);
|
|
|
}, [depth, filter, num, prefix, reverse, sort, except]);
|
|
}, [depth, filter, num, prefix, reverse, sort, except]);
|
|
|
|
|
|
|
|
- const { data, error } = useSWRxNodeTree(lsxContext, isImmutable);
|
|
|
|
|
|
|
+ const pathname = window.location.pathname;
|
|
|
|
|
+ const isSharedPage = pagePathUtils.isSharedPage(pathname);
|
|
|
|
|
+
|
|
|
|
|
+ const { data, error } = useSWRxNodeTree(!isSharedPage, lsxContext, isImmutable);
|
|
|
|
|
|
|
|
const isLoading = data === undefined;
|
|
const isLoading = data === undefined;
|
|
|
const hasError = error != null;
|
|
const hasError = error != null;
|
|
@@ -82,6 +86,15 @@ export const Lsx = React.memo(({
|
|
|
return <LsxListView nodeTree={data.nodeTree} lsxContext={lsxContext} basisViewersCount={data.toppageViewersCount} />;
|
|
return <LsxListView nodeTree={data.nodeTree} lsxContext={lsxContext} basisViewersCount={data.toppageViewersCount} />;
|
|
|
}, [data?.nodeTree, data?.toppageViewersCount, isLoading, lsxContext]);
|
|
}, [data?.nodeTree, data?.toppageViewersCount, isLoading, lsxContext]);
|
|
|
|
|
|
|
|
|
|
+ if (isSharedPage) {
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div className="text-warning">
|
|
|
|
|
+ <i className="fa fa-exclamation-triangle fa-fw"></i>
|
|
|
|
|
+ {lsxContext.toString()} (-> <small>lsx is not available on the share link page</small>)
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<div className={`lsx ${styles.lsx}`}>
|
|
<div className={`lsx ${styles.lsx}`}>
|
|
|
<Error />
|
|
<Error />
|