Transition, Right Column: Fix redundant "You must be admin" popup
This commit is contained in:
parent
7ef0a89adb
commit
9bdaa5fdbc
@ -277,8 +277,7 @@ const Profile: FC<OwnProps & StateProps> = ({
|
|||||||
|
|
||||||
function renderSharedMedia() {
|
function renderSharedMedia() {
|
||||||
if (!viewportIds || !canRenderContents || !chatMessages) {
|
if (!viewportIds || !canRenderContents || !chatMessages) {
|
||||||
// This is just a single-frame delay, so we do not show spinner
|
const noSpinner = isFirstTab && !canRenderContents;
|
||||||
const noSpinner = isFirstTab && viewportIds && !canRenderContents;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="content empty-list">
|
<div className="content empty-list">
|
||||||
|
|||||||
@ -311,7 +311,6 @@ const RightColumn: FC<StateProps> = ({
|
|||||||
renderCount={MAIN_SCREENS_COUNT + MANAGEMENT_SCREENS_COUNT}
|
renderCount={MAIN_SCREENS_COUNT + MANAGEMENT_SCREENS_COUNT}
|
||||||
activeKey={isManagement ? MAIN_SCREENS_COUNT + managementScreen : renderingContentKey}
|
activeKey={isManagement ? MAIN_SCREENS_COUNT + managementScreen : renderingContentKey}
|
||||||
shouldCleanup
|
shouldCleanup
|
||||||
cleanupExceptionKey={RightColumnContent.ChatInfo}
|
|
||||||
>
|
>
|
||||||
{renderContent}
|
{renderContent}
|
||||||
</Transition>
|
</Transition>
|
||||||
|
|||||||
@ -36,8 +36,6 @@ export type TransitionProps = {
|
|||||||
children: ChildrenFn;
|
children: ChildrenFn;
|
||||||
};
|
};
|
||||||
|
|
||||||
const CLEANED_UP = Symbol('CLEANED_UP');
|
|
||||||
|
|
||||||
const classNames = {
|
const classNames = {
|
||||||
active: 'Transition__slide--active',
|
active: 'Transition__slide--active',
|
||||||
};
|
};
|
||||||
@ -67,7 +65,7 @@ const Transition: FC<TransitionProps> = ({
|
|||||||
containerRef = ref;
|
containerRef = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rendersRef = useRef<Record<number, ChildrenFn | typeof CLEANED_UP>>({});
|
const rendersRef = useRef<Record<number, ChildrenFn>>({});
|
||||||
const prevActiveKey = usePrevious<any>(activeKey);
|
const prevActiveKey = usePrevious<any>(activeKey);
|
||||||
const forceUpdate = useForceUpdate();
|
const forceUpdate = useForceUpdate();
|
||||||
|
|
||||||
@ -81,11 +79,14 @@ const Transition: FC<TransitionProps> = ({
|
|||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
function cleanup() {
|
function cleanup() {
|
||||||
if (!shouldCleanup || (cleanupExceptionKey !== undefined && cleanupExceptionKey === prevActiveKey)) {
|
if (!shouldCleanup) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rendersRef.current = { [prevActiveKey]: CLEANED_UP };
|
const preservedRender = cleanupExceptionKey !== undefined ? rendersRef.current[cleanupExceptionKey] : undefined;
|
||||||
|
|
||||||
|
rendersRef.current = preservedRender ? { [cleanupExceptionKey!]: preservedRender } : {};
|
||||||
|
|
||||||
forceUpdate();
|
forceUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,11 +252,12 @@ const Transition: FC<TransitionProps> = ({
|
|||||||
|
|
||||||
const contents = collection.map((key) => {
|
const contents = collection.map((key) => {
|
||||||
const render = renders[key];
|
const render = renders[key];
|
||||||
|
if (!render) {
|
||||||
|
return undefined;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
typeof render === 'function' ? (
|
<div key={key} teactOrderKey={key}>{render(key === activeKey, key === prevActiveKey, activeKey)}</div>
|
||||||
<div key={key} teactOrderKey={key}>{render(key === activeKey, key === prevActiveKey, activeKey)}</div>
|
|
||||||
) : undefined
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user