Skip to content

Commit

Permalink
chore: Fix shadowed variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Jacobs committed Mar 3, 2023
1 parent 8ff31d4 commit 6beabbd
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions addons/ondevice-controls/src/ControlsPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ const ControlsPanel = ({ api }: { api: API }) => {
const [isPristine, setIsPristine] = useState(true);
const [argsFromHook, updateArgs, resetArgs] = useArgs(storyId, store);
const { argsObject, argTypes, parameters } = React.useMemo(() => {
const { argTypes, parameters } = store.fromId(storyId) as StoryContext;
const argsObject = Object.entries(argTypes).reduce((prev, [key, argType]) => {
const { argTypes: storyArgTypes, parameters: storyParameters } = store.fromId(
storyId
) as StoryContext;
const storyArgsObject = Object.entries(storyArgTypes).reduce((prev, [key, argType]) => {
const isControl = Boolean(argType?.control);
return isControl
? {
Expand All @@ -70,9 +72,9 @@ const ControlsPanel = ({ api }: { api: API }) => {
: prev;
}, {});
return {
argTypes,
parameters,
argsObject,
argTypes: storyArgTypes,
parameters: storyParameters,
argsObject: storyArgsObject,
};
}, [store, storyId, argsFromHook]);
const hasControls = Object.keys(argTypes).length > 0;
Expand Down

0 comments on commit 6beabbd

Please sign in to comment.