mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-17 21:15:32 +09:00
16 lines
667 B
TypeScript
16 lines
667 B
TypeScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
|
|
import {useEffect, useRef} from 'react';
|
|
|
|
export function useChannelMemberListVisibility(channelId: string | null, visible: boolean): void {
|
|
const previousVisibilityRef = useRef({channelId, visible});
|
|
useEffect(() => {
|
|
const previousVisibility = previousVisibilityRef.current;
|
|
previousVisibilityRef.current = {channelId, visible};
|
|
if (!channelId) return;
|
|
if (previousVisibility.channelId === channelId && previousVisibility.visible === visible) return;
|
|
ComponentBus.dispatch('LAYOUT_RESIZED', {channelId});
|
|
}, [channelId, visible]);
|
|
}
|