mirror of
https://github.com/danog/telegram-tt.git
synced 2024-11-30 04:39:00 +01:00
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() {
|
||||
if (!viewportIds || !canRenderContents || !chatMessages) {
|
||||
// This is just a single-frame delay, so we do not show spinner
|
||||
const noSpinner = isFirstTab && viewportIds && !canRenderContents;
|
||||
const noSpinner = isFirstTab && !canRenderContents;
|
||||
|
||||
return (
|
||||
<div className="content empty-list">
|
||||
|
@ -311,7 +311,6 @@ const RightColumn: FC<StateProps> = ({
|
||||
renderCount={MAIN_SCREENS_COUNT + MANAGEMENT_SCREENS_COUNT}
|
||||
activeKey={isManagement ? MAIN_SCREENS_COUNT + managementScreen : renderingContentKey}
|
||||
shouldCleanup
|
||||
cleanupExceptionKey={RightColumnContent.ChatInfo}
|
||||
>
|
||||
{renderContent}
|
||||
</Transition>
|
||||
|
@ -36,8 +36,6 @@ export type TransitionProps = {
|
||||
children: ChildrenFn;
|
||||
};
|
||||
|
||||
const CLEANED_UP = Symbol('CLEANED_UP');
|
||||
|
||||
const classNames = {
|
||||
active: 'Transition__slide--active',
|
||||
};
|
||||
@ -67,7 +65,7 @@ const Transition: FC<TransitionProps> = ({
|
||||
containerRef = ref;
|
||||
}
|
||||
|
||||
const rendersRef = useRef<Record<number, ChildrenFn | typeof CLEANED_UP>>({});
|
||||
const rendersRef = useRef<Record<number, ChildrenFn>>({});
|
||||
const prevActiveKey = usePrevious<any>(activeKey);
|
||||
const forceUpdate = useForceUpdate();
|
||||
|
||||
@ -81,11 +79,14 @@ const Transition: FC<TransitionProps> = ({
|
||||
|
||||
useLayoutEffect(() => {
|
||||
function cleanup() {
|
||||
if (!shouldCleanup || (cleanupExceptionKey !== undefined && cleanupExceptionKey === prevActiveKey)) {
|
||||
if (!shouldCleanup) {
|
||||
return;
|
||||
}
|
||||
|
||||
rendersRef.current = { [prevActiveKey]: CLEANED_UP };
|
||||
const preservedRender = cleanupExceptionKey !== undefined ? rendersRef.current[cleanupExceptionKey] : undefined;
|
||||
|
||||
rendersRef.current = preservedRender ? { [cleanupExceptionKey!]: preservedRender } : {};
|
||||
|
||||
forceUpdate();
|
||||
}
|
||||
|
||||
@ -251,11 +252,12 @@ const Transition: FC<TransitionProps> = ({
|
||||
|
||||
const contents = collection.map((key) => {
|
||||
const render = renders[key];
|
||||
if (!render) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
typeof render === 'function' ? (
|
||||
<div key={key} teactOrderKey={key}>{render(key === activeKey, key === prevActiveKey, activeKey)}</div>
|
||||
) : undefined
|
||||
<div key={key} teactOrderKey={key}>{render(key === activeKey, key === prevActiveKey, activeKey)}</div>
|
||||
);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user