From b9fbf1e2dabe9d281fd3eaed76d48837f87743c6 Mon Sep 17 00:00:00 2001 From: Philipp Otto Date: Mon, 6 Feb 2023 13:42:07 +0100 Subject: [PATCH] Fix saving allowed teams in dataset settings (#6817) * fix saving allowed teams in dataset settings * update changelog --------- Co-authored-by: Jonathan Striebel --- CHANGELOG.unreleased.md | 1 + .../components/pricing_enforcers.tsx | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.unreleased.md b/CHANGELOG.unreleased.md index a56488fd92b..f9d0e97c961 100644 --- a/CHANGELOG.unreleased.md +++ b/CHANGELOG.unreleased.md @@ -17,6 +17,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released ### Fixed - Fixed a benign error message which briefly appeared after logging in. [#6810](https://github.com/scalableminds/webknossos/pull/6810) +- Fixed saving allowed teams in dataset settings [#6817](https://github.com/scalableminds/webknossos/pull/6817) ### Removed diff --git a/frontend/javascripts/components/pricing_enforcers.tsx b/frontend/javascripts/components/pricing_enforcers.tsx index c4edcc454e3..b08d6b4dc85 100644 --- a/frontend/javascripts/components/pricing_enforcers.tsx +++ b/frontend/javascripts/components/pricing_enforcers.tsx @@ -78,11 +78,26 @@ export const PricingEnforcedButton: React.FunctionComponent = ({ children, requiredPricingPlan, + ...restProps }) => { const activeOrganization = useSelector((state: OxalisState) => state.activeOrganization); const isFeatureAllowed = isFeatureAllowedByPricingPlan(activeOrganization, requiredPricingPlan); - if (isFeatureAllowed) return <>{children}; + if (isFeatureAllowed) + // Spread additional props to the children (required since antd's form implementation + // typically fills value and onChange props on children of FormItems). + return ( + <> + {React.Children.map(children, (child) => { + if (!React.isValidElement(child)) { + return child; + } + return React.cloneElement(child, { + ...restProps, + }); + })} + + ); return (