Fix RoomViewStore forgetting some details of a view room call (#7512)
This commit is contained in:
parent
3a18fd8f71
commit
ec6c1b8272
21 changed files with 67 additions and 57 deletions
|
@ -25,6 +25,7 @@ import RoomAvatar from "../avatars/RoomAvatar";
|
|||
import dis from "../../../dispatcher/dispatcher";
|
||||
import InteractiveTooltip, { Direction } from "../elements/InteractiveTooltip";
|
||||
import { roomContextDetailsText } from "../../../Rooms";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
|
||||
const RecentlyViewedButton = () => {
|
||||
const tooltipRef = useRef<InteractiveTooltip>();
|
||||
|
@ -40,7 +41,7 @@ const RecentlyViewedButton = () => {
|
|||
key={crumb.roomId}
|
||||
onClick={() => {
|
||||
dis.dispatch({
|
||||
action: "view_room",
|
||||
action: Action.ViewRoom,
|
||||
room_id: crumb.roomId,
|
||||
});
|
||||
tooltipRef.current?.hideTooltip();
|
||||
|
|
|
@ -27,6 +27,7 @@ import { UPDATE_EVENT } from "../../../stores/AsyncStore";
|
|||
import { RovingAccessibleTooltipButton } from "../../../accessibility/RovingTabIndex";
|
||||
import Toolbar from "../../../accessibility/Toolbar";
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
|
||||
interface IProps {
|
||||
}
|
||||
|
@ -78,7 +79,10 @@ export default class RoomBreadcrumbs extends React.PureComponent<IProps, IState>
|
|||
|
||||
private viewRoom = (room: Room, index: number) => {
|
||||
Analytics.trackEvent("Breadcrumbs", "click_node", String(index));
|
||||
defaultDispatcher.dispatch({ action: "view_room", room_id: room.roomId });
|
||||
defaultDispatcher.dispatch({
|
||||
action: Action.ViewRoom,
|
||||
room_id: room.roomId,
|
||||
});
|
||||
};
|
||||
|
||||
public render(): React.ReactElement {
|
||||
|
|
|
@ -47,12 +47,12 @@ import AccessibleButton from "../elements/AccessibleButton";
|
|||
import { CommunityPrototypeStore } from "../../../stores/CommunityPrototypeStore";
|
||||
import SpaceStore from "../../../stores/spaces/SpaceStore";
|
||||
import {
|
||||
isMetaSpace,
|
||||
ISuggestedRoom,
|
||||
MetaSpace,
|
||||
SpaceKey,
|
||||
UPDATE_SUGGESTED_ROOMS,
|
||||
UPDATE_SELECTED_SPACE,
|
||||
isMetaSpace,
|
||||
UPDATE_SUGGESTED_ROOMS,
|
||||
} from "../../../stores/spaces";
|
||||
import { shouldShowSpaceInvite, showAddExistingRooms, showCreateNewRoom, showSpaceInvite } from "../../../utils/space";
|
||||
import { replaceableComponent } from "../../../utils/replaceableComponent";
|
||||
|
@ -215,7 +215,7 @@ const UntaggedAuxButton = ({ tabIndex }: IAuxButtonProps) => {
|
|||
e.stopPropagation();
|
||||
closeMenu();
|
||||
defaultDispatcher.dispatch({
|
||||
action: "view_room",
|
||||
action: Action.ViewRoom,
|
||||
room_id: activeSpace.roomId,
|
||||
});
|
||||
}}
|
||||
|
@ -497,7 +497,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
private onExplore = () => {
|
||||
if (!isMetaSpace(this.props.activeSpace)) {
|
||||
defaultDispatcher.dispatch({
|
||||
action: "view_room",
|
||||
action: Action.ViewRoom,
|
||||
room_id: this.props.activeSpace,
|
||||
});
|
||||
} else {
|
||||
|
@ -522,7 +522,7 @@ export default class RoomList extends React.PureComponent<IProps, IState> {
|
|||
);
|
||||
const viewRoom = () => {
|
||||
defaultDispatcher.dispatch({
|
||||
action: "view_room",
|
||||
action: Action.ViewRoom,
|
||||
room_alias: room.canonical_alias || room.aliases?.[0],
|
||||
room_id: room.room_id,
|
||||
via_servers: room.viaServers,
|
||||
|
|
|
@ -97,7 +97,7 @@ const PrototypeCommunityContextMenu = (props: ComponentProps<typeof SpaceContext
|
|||
const chat = CommunityPrototypeStore.instance.getSelectedCommunityGeneralChat();
|
||||
if (chat) {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
action: Action.ViewRoom,
|
||||
room_id: chat.roomId,
|
||||
}, true);
|
||||
RightPanelStore.instance.setCard({ phase: RightPanelPhases.RoomMemberList }, undefined, chat.roomId);
|
||||
|
|
|
@ -294,7 +294,7 @@ export default class RoomSublist extends React.Component<IProps, IState> {
|
|||
};
|
||||
|
||||
private onAction = (payload: ActionPayload) => {
|
||||
if (payload.action === "view_room" && payload.show_room_tile && this.state.rooms) {
|
||||
if (payload.action === Action.ViewRoom && payload.show_room_tile && this.state.rooms) {
|
||||
// XXX: we have to do this a tick later because we have incorrect intermediate props during a room change
|
||||
// where we lose the room we are changing from temporarily and then it comes back in an update right after.
|
||||
setImmediate(() => {
|
||||
|
|
|
@ -197,7 +197,10 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
|||
}
|
||||
|
||||
private onAction = (payload: ActionPayload) => {
|
||||
if (payload.action === "view_room" && payload.room_id === this.props.room.roomId && payload.show_room_tile) {
|
||||
if (payload.action === Action.ViewRoom &&
|
||||
payload.room_id === this.props.room.roomId &&
|
||||
payload.show_room_tile
|
||||
) {
|
||||
setImmediate(() => {
|
||||
this.scrollIntoView();
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue