refactor(app): rename ComponentDispatch to ComponentBus (#1844)

This commit is contained in:
Hampus authored and GitHub committed 2026-08-24 12:29:38 +02:00
1 parent 01a29d629b
commit c285854b71
68 files changed
+219 -219

No files matched your search

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import {MentionUserIcon} from '@app/features/ui/action_menu/ContextMenuIcons';
import {MenuItem} from '@app/features/ui/action_menu/MenuItem';
import type {User} from '@app/features/user/models/User';
@@ -24,7 +24,7 @@ export const MentionUserMenuItem: React.FC<MentionUserMenuItemProps> = observer(
const {i18n} = useLingui();
const handleMentionUser = useCallback(() => {
onClose();
ComponentDispatch.dispatch('INSERT_MENTION', {userId: user.id});
ComponentBus.dispatch('INSERT_MENTION', {userId: user.id});
}, [user.id, onClose]);
return (
<MenuItem
@@ -43,7 +43,7 @@ import {useRoleHierarchy} from '@app/features/permissions/hooks/useRoleHierarchy
import Permission from '@app/features/permissions/state/Permission';
import * as PermissionUtils from '@app/features/permissions/utils/PermissionUtils';
import {Logger} from '@app/features/platform/utils/AppLogger';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import {ChangeFriendNicknameModal} from '@app/features/relationship/components/modals/ChangeFriendNicknameModal';
import Relationships from '@app/features/relationship/state/Relationships';
import * as RelationshipActionUtils from '@app/features/relationship/utils/RelationshipActionUtils';
@@ -601,7 +601,7 @@ export function useVoiceParticipantMenuData(options: VoiceParticipantMenuDataOpt
label: i18n._(MENTION_DESCRIPTOR),
onClick: () => {
onClose();
ComponentDispatch.dispatch('INSERT_MENTION', {userId: user.id});
ComponentBus.dispatch('INSERT_MENTION', {userId: user.id});
},
});
}
@@ -3,7 +3,7 @@
import {useMergeRefs} from '@app/features/app/hooks/useMergeRefs';
import {isKeyboardActivationKey} from '@app/features/input/utils/KeyboardUtils';
import type {ComponentActionType} from '@app/features/platform/utils/ComponentBus';
import {ComponentDispatch} from '@app/features/platform/utils/ComponentBus';
import {ComponentBus} from '@app/features/platform/utils/ComponentBus';
import * as PopoutCommands from '@app/features/ui/commands/PopoutCommands';
import {
type PopoutAnimationType,
@@ -373,8 +373,8 @@ export const Popout = React.forwardRef<HTMLElement, PopoutProps>((props, ref) =>
useEffect(() => {
if (!props.subscribeTo) return;
const handler = () => toggle();
ComponentDispatch.subscribe(props.subscribeTo, handler);
return () => ComponentDispatch.unsubscribe(props.subscribeTo!, handler);
ComponentBus.subscribe(props.subscribeTo, handler);
return () => ComponentBus.unsubscribe(props.subscribeTo!, handler);
}, [props.subscribeTo, toggle]);
const childToRender =
(props.children as React.ReactNode) || (!props.closeOnChildrenUnmount ? state.lastValidChildren : null);