Skip to content

Commit

Permalink
fix: restore selected-item cosmoz-tabs notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
megheaiulian committed Sep 24, 2020
1 parent 3905cd7 commit d08a992
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/use-tabs.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import { notifyProperty } from '@neovici/cosmoz-utils/lib/hooks/use-notify-property';
import {
useState, useEffect, useMemo, useCallback
} from 'haunted';
import { notifyProperty } from '@neovici/cosmoz-utils/lib/hooks/use-notify-property';
import {
useHashParam, link
} from './use-hash-param';
import {
choose, getName, isValid
} from './utils';

const useTabSelectedEffect = selectedTab => {
const useTabSelectedEffect = (host, selectedTab) => {
useEffect(() => {
notifyProperty(host, 'selectedItem', selectedTab);
if (!selectedTab) {
return;
}
Expand Down Expand Up @@ -42,7 +43,7 @@ const useTabSelectedEffect = selectedTab => {
selection = hashParam == null || param == null && selected != null ? selected : param,
selectedTab = useMemo(() => choose(tabs, selection), [tabs, selection]);

useTabSelectedEffect(selectedTab);
useTabSelectedEffect(host, selectedTab);

useEffect(() => {
const onTabAlter = e => {
Expand Down

0 comments on commit d08a992

Please sign in to comment.