Skip to content

Commit

Permalink
fix: rule of hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
atanasster committed Dec 18, 2020
1 parent c9d854d commit c586ce6
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions ui/app/src/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
useStore,
useCurrentDocument,
useDocByType,
useConfig,
useActiveTab,
useCurrentStory,
} from '@component-controls/store';
Expand Down Expand Up @@ -171,10 +170,10 @@ export const Sidebar: FC<SidebarProps> = ({
const { title: docId } = useCurrentDocument() || {};
const story = useCurrentStory();
const activeId = story ? story.id : docId;
const config = useConfig() || {};
const docs: Pages = useDocByType(type);
const [search, setSearch] = useState<string | undefined>(undefined);
const node = useMemo(() => {
const { config } = store;
const { pages, menu, sidebar = [] } = config;
const page: PageConfiguration = pages?.[type] || {};
const { label = '' } = page;
Expand Down Expand Up @@ -252,16 +251,6 @@ export const Sidebar: FC<SidebarProps> = ({
</Box>
</AppSidebar>
);
}, [
activeId,
activeTab,
config,
docs,
propsTitle,
responsive,
search,
store,
type,
]);
}, [activeId, activeTab, docs, propsTitle, responsive, search, store, type]);
return node;
};

0 comments on commit c586ce6

Please sign in to comment.