Skip to content

Commit

Permalink
fix python panel state change from DynamicIO
Browse files Browse the repository at this point in the history
  • Loading branch information
imanjra committed Mar 11, 2025
1 parent fcf3bcc commit 0292f24
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions app/packages/operators/src/useCustomPanelHooks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { debounce, merge } from "lodash";
import { debounce, merge, mergeWith } from "lodash";
import { useCallback, useEffect, useMemo } from "react";

import { usePanelState, useSetCustomPanelState } from "@fiftyone/spaces";
Expand Down Expand Up @@ -191,8 +191,12 @@ export function useCustomPanelHooks(props: CustomPanelProps): CustomPanelHooks {
]);

const handlePanelStateChange = (newState) => {
setCustomPanelState((state: any) => {
return merge({}, state, newState);
setCustomPanelState((state: unknown) => {
return mergeWith({}, state, newState, (objValue, srcValue) => {
if (Array.isArray(objValue)) {
return srcValue; // Overwrite instead of merging arrays
}
});
});
};

Expand Down

0 comments on commit 0292f24

Please sign in to comment.