Remove rateLimitedFunc

This commit is contained in:
David Baker 2021-07-01 18:35:38 +01:00
parent fdef1f9b68
commit ae16efcf5b
8 changed files with 24 additions and 73 deletions

View file

@ -23,7 +23,6 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest";
import dis from '../../dispatcher/dispatcher';
import RateLimitedFunc from '../../ratelimitedfunc';
import GroupStore from '../../stores/GroupStore';
import {
RIGHT_PANEL_PHASES_NO_ARGS,
@ -48,6 +47,7 @@ import FilePanel from "./FilePanel";
import NotificationPanel from "./NotificationPanel";
import ResizeNotifier from "../../utils/ResizeNotifier";
import PinnedMessagesCard from "../views/right_panel/PinnedMessagesCard";
import { DebouncedFunc, throttle } from 'lodash';
interface IProps {
room?: Room; // if showing panels for a given room, this is set
@ -73,7 +73,7 @@ interface IState {
export default class RightPanel extends React.Component<IProps, IState> {
static contextType = MatrixClientContext;
private readonly delayedUpdate: RateLimitedFunc;
private readonly delayedUpdate: DebouncedFunc<() => void>;
private dispatcherRef: string;
constructor(props, context) {
@ -85,9 +85,9 @@ export default class RightPanel extends React.Component<IProps, IState> {
member: this.getUserForPanel(),
};
this.delayedUpdate = new RateLimitedFunc(() => {
this.delayedUpdate = throttle(() => {
this.forceUpdate();
}, 500);
}, 500, { leading: true, trailing: true });
}
// Helper function to split out the logic for getPhaseFromProps() and the constructor