-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Move ResizerNotifier into SDKContext #30939
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
3dc9a6f
4aa4b71
83f583d
478c279
c45cc4f
86f34e7
d198ccd
79dddb6
ef605e1
4d0a5f8
2286d2e
e1597bc
526a2e9
ccedf2a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,6 @@ import SettingsStore from "../../settings/SettingsStore"; | |
| import { SettingLevel } from "../../settings/SettingLevel"; | ||
| import ResizeHandle from "../views/elements/ResizeHandle"; | ||
| import { CollapseDistributor, Resizer } from "../../resizer"; | ||
| import type ResizeNotifier from "../../utils/ResizeNotifier"; | ||
| import PlatformPeg from "../../PlatformPeg"; | ||
| import { DefaultTagID } from "../../stores/room-list/models"; | ||
| import { hideToast as hideServerLimitToast, showToast as showServerLimitToast } from "../../toasts/ServerLimitToast"; | ||
|
|
@@ -67,6 +66,7 @@ import { monitorSyncedPushRules } from "../../utils/pushRules/monitorSyncedPushR | |
| import { type ConfigOptions } from "../../SdkConfig"; | ||
| import { MatrixClientContextProvider } from "./MatrixClientContextProvider"; | ||
| import { Landmark, LandmarkNavigation } from "../../accessibility/LandmarkNavigation"; | ||
| import { SDKContext } from "../../contexts/SDKContext.ts"; | ||
|
|
||
| // We need to fetch each pinned message individually (if we don't already have it) | ||
| // so each pinned message may trigger a request. Limit the number per room for sanity. | ||
|
|
@@ -86,7 +86,6 @@ interface IProps { | |
| // transitioned to PWLU) | ||
| onRegistered: (credentials: IMatrixClientCreds) => Promise<MatrixClient>; | ||
| hideToSRUsers: boolean; | ||
| resizeNotifier: ResizeNotifier; | ||
| // eslint-disable-next-line camelcase | ||
| page_type?: string; | ||
| autoJoin?: boolean; | ||
|
|
@@ -134,8 +133,11 @@ class LoggedInView extends React.Component<IProps, IState> { | |
| protected timezoneProfileUpdateRef?: string[]; | ||
| protected resizer?: Resizer<ICollapseConfig, CollapseItem>; | ||
|
|
||
| public constructor(props: IProps) { | ||
| super(props); | ||
| public static contextType = SDKContext; | ||
| declare public context: React.ContextType<typeof SDKContext>; | ||
|
|
||
| public constructor(props: IProps, context: React.ContextType<typeof SDKContext>) { | ||
| super(props, context); | ||
|
|
||
| this.state = { | ||
| syncErrorData: undefined, | ||
|
|
@@ -281,15 +283,15 @@ class LoggedInView extends React.Component<IProps, IState> { | |
| }, | ||
| onResized: (size) => { | ||
| panelSize = size; | ||
| this.props.resizeNotifier.notifyLeftHandleResized(); | ||
| this.context.resizeNotifier.notifyLeftHandleResized(); | ||
| }, | ||
| onResizeStart: () => { | ||
| this.props.resizeNotifier.startResizing(); | ||
| this.context.resizeNotifier.startResizing(); | ||
| }, | ||
| onResizeStop: () => { | ||
| // Always save the lhs size for the new room list. | ||
| if (useNewRoomList || !panelCollapsed) window.localStorage.setItem("mx_lhs_size", "" + panelSize); | ||
| this.props.resizeNotifier.stopResizing(); | ||
| this.context.resizeNotifier.stopResizing(); | ||
| }, | ||
| isItemCollapsed: (domNode) => { | ||
| // New rooms list does not support collapsing. | ||
|
|
@@ -681,7 +683,6 @@ class LoggedInView extends React.Component<IProps, IState> { | |
| threepidInvite={this.props.threepidInvite} | ||
| oobData={this.props.roomOobData} | ||
| key={this.props.currentRoomId || "roomview"} | ||
| resizeNotifier={this.props.resizeNotifier} | ||
| justCreatedOpts={this.props.roomJustCreatedOpts} | ||
| forceTimeline={this.props.forceTimeline} | ||
| /> | ||
|
|
@@ -695,7 +696,7 @@ class LoggedInView extends React.Component<IProps, IState> { | |
| case PageTypes.UserView: | ||
| if (!!this.props.currentUserId) { | ||
| pageElement = ( | ||
| <UserView userId={this.props.currentUserId} resizeNotifier={this.props.resizeNotifier} /> | ||
| <UserView userId={this.props.currentUserId} resizeNotifier={this.context.resizeNotifier} /> | ||
| ); | ||
| } | ||
| break; | ||
|
|
@@ -748,7 +749,7 @@ class LoggedInView extends React.Component<IProps, IState> { | |
| <LeftPanel | ||
| pageType={this.props.page_type as PageTypes} | ||
| isMinimized={shouldUseMinimizedUI || false} | ||
| resizeNotifier={this.props.resizeNotifier} | ||
| resizeNotifier={this.context.resizeNotifier} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ditto for LeftPanel
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This only gets resizeNotifier so it can pass it into the legacy room list which doesn't seem worth changing at this point, it can just be stripped out when the old room list dies? |
||
| /> | ||
| </div> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can UserView not also consume it via ctx?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately UserView uses MatrixClientContext so suffers the multiple-context problem as it's still a class component.