From ad1f2cedbde4df6974412d37fd84119208902065 Mon Sep 17 00:00:00 2001 From: Victor Lin <13424970+victorlin@users.noreply.github.com> Date: Tue, 5 Nov 2024 16:58:58 -0800 Subject: [PATCH] Allow setState to take a partial state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit React will shallow merge the provided object into the existing state¹ which works for our usage. The type definition of setState does not allow partial state by default. Use 'never' to configure it to expect no fields in particular². ¹ ² --- src/components/tree/tree.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/tree/tree.tsx b/src/components/tree/tree.tsx index c93773edd..fedd473e7 100644 --- a/src/components/tree/tree.tsx +++ b/src/components/tree/tree.tsx @@ -137,7 +137,7 @@ export class TreeComponent extends React.Component(newState); /* this will trigger an unnecessary CDU :( */ } } @@ -175,7 +175,7 @@ export class TreeComponent extends React.Component(newState); } override componentWillUnmount() {