From cf58a0c4515f4c8ba772c00ca02a9f928fe749fc Mon Sep 17 00:00:00 2001 From: abias Date: Sun, 21 May 2023 12:40:22 -0400 Subject: [PATCH] Allow user to submit rate limit changes --- src/shared/components/common/tabs.tsx | 1 + src/shared/components/home/admin-settings.tsx | 4 + .../components/home/rate-limit-form.tsx | 173 ++++++++++++------ 3 files changed, 124 insertions(+), 54 deletions(-) diff --git a/src/shared/components/common/tabs.tsx b/src/shared/components/common/tabs.tsx index 36e1a015..61ed396e 100644 --- a/src/shared/components/common/tabs.tsx +++ b/src/shared/components/common/tabs.tsx @@ -35,6 +35,7 @@ export default class Tabs extends Component { {this.props.tabs.map(({ key, label }) => (
  • + + + ); } + + componentDidUpdate({ localSiteRateLimit }: RateLimitFormProps) { + if ( + this.state.loading && + Object.entries(localSiteRateLimit).some( + ([key, val]) => this.state.form[key] !== val + ) + ) { + this.setState({ loading: false }); + } + } }