FIX issue with design-assets addon && CLEANUP && FIX proptype errors

This commit is contained in:
Norbert de Langen 2019-07-12 20:55:16 +02:00
parent 9ed36d93b4
commit d6317a32b2
9 changed files with 18 additions and 31 deletions

View File

@ -50,16 +50,15 @@ export const Panel = () => {
const [selected, setSelected] = useAddonState<Selected>(ADDON_ID, 0);
const { storyId } = useStorybookState();
if (results.length === 0) {
return null;
}
if (results.length && !results[selected]) {
setSelected(0);
return null;
}
return useMemo(() => {
if (results.length === 0) {
return null;
}
if (results.length && !results[selected]) {
setSelected(0);
return null;
}
const url = getUrl(results[selected]).replace('{id}', storyId);
return (
<Fragment>

View File

@ -1,3 +1,4 @@
/* eslint-disable no-fallthrough */
import React, { Fragment, ReactNode, useEffect, useRef, FunctionComponent } from 'react';
import memoize from 'memoizerific';
@ -40,7 +41,6 @@ const toLinks = memoize(50)((list: ViewportItem[], active: LinkBase, set, state,
return null;
}
}
// eslint-disable-next-line no-fallthrough
default: {
return {
...i,
@ -149,10 +149,6 @@ export const ViewportTool: FunctionComponent<{}> = React.memo(
ref.current = styles;
}, [item]);
if (styles === null) {
// debugger;
}
if (disable || Object.entries(viewports).length === 0) {
return null;
}

View File

@ -325,7 +325,6 @@ export function useAddonState<S>(addonId: string, defaultState?: S) {
if (typeof existingState === 'undefined' && typeof state !== 'undefined') {
if (!ref.current[addonId]) {
// debugger;
api.setAddonState<S>(addonId, state);
ref.current[addonId] = true;
}

View File

@ -127,7 +127,6 @@ export default ({ provider, store }: Module) => {
.then(() => api.getAddonState(addonId));
},
getAddonState: addonId => {
// debugger;
return store.getState().addons[addonId];
},
};

View File

@ -37,9 +37,6 @@ export class IFrame extends React.Component<IFrameProps> {
transformOrigin: 'top left',
});
}
// if(this.props.src !== src) {
// debugger;
// }
return false;
}

View File

@ -549,7 +549,7 @@ Layout.propTypes = {
showNav: PropTypes.bool.isRequired,
showPanel: PropTypes.bool.isRequired,
panelPosition: PropTypes.string.isRequired,
isToolshown: PropTypes.string.isRequired,
isToolshown: PropTypes.bool.isRequired,
}).isRequired,
viewMode: PropTypes.oneOf(['story', 'info', 'docs', 'settings']),
theme: PropTypes.shape({ layoutMargin: PropTypes.number }).isRequired,

View File

@ -127,9 +127,7 @@ export const PureSidebarSearch = ({ className, onChange, ...props }) => {
PureSidebarSearch.propTypes = {
className: PropTypes.string,
focussed: PropTypes.bool.isRequired,
onChange: PropTypes.func.isRequired,
onSetFocussed: PropTypes.func.isRequired,
};
PureSidebarSearch.defaultProps = {

View File

@ -392,14 +392,14 @@ TreeState.propTypes = {
prefix: PropTypes.string.isRequired,
dataset: PropTypes.shape({}).isRequired,
selectedId: PropTypes.string,
Filter: PropTypes.element,
List: PropTypes.element,
Title: PropTypes.element,
Link: PropTypes.element,
Leaf: PropTypes.element,
Head: PropTypes.element,
Section: PropTypes.element,
Message: PropTypes.element,
Filter: PropTypes.elementType,
List: PropTypes.elementType,
Title: PropTypes.elementType,
Link: PropTypes.elementType,
Leaf: PropTypes.elementType,
Head: PropTypes.elementType,
Section: PropTypes.elementType,
Message: PropTypes.elementType,
};
TreeState.defaultProps = {
selectedId: null,

View File

@ -68,7 +68,6 @@ export const getPrevious = ({ id, dataset, expanded }) => {
// find previous sibling
// recurse into that sibling's last children that are expanded
// debugger;
const current = get(id, dataset);
const parent = getParent(id, dataset);
const mains = getMainsKeys(dataset);