Skip to content

Commit

Permalink
fix: undo section id + some minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanHotsiy committed Jan 10, 2018
1 parent b7f0a1a commit 0253c5d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/components/ContentItems/ContentItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,11 @@ export class ContentItem extends React.Component<ContentItemProps> {
export class TagItem extends React.Component<ContentItemProps> {
render() {
const { name, description } = this.props.item;
const hash = this.props.item.getHash();
return (
<Row>
<MiddlePanel key="middle">
<H1 id={hash}>
<ShareLink href={'#' + hash} />
<H1>
<ShareLink href={'#' + this.props.item.getHash()} />
{name}
</H1>
{description !== undefined && <Markdown source={description} />}
Expand Down
5 changes: 2 additions & 3 deletions src/components/Operation/Operation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ export class Operation extends ComponentWithOptions<OperationProps> {

const { name: summary, description, deprecated } = operation;
const pathInMiddle = this.options.pathInMiddlePanel;
const hash = operation.getHash();
return (
<OperationRow>
<MiddlePanel>
<H2 id={hash}>
<ShareLink href={'#' + hash} />
<H2>
<ShareLink href={'#' + operation.getHash()} />
{summary} {deprecated && <Badge type="warning"> Deprecated </Badge>}
</H2>
{pathInMiddle && <Endpoint operation={operation} inverted={true} />}
Expand Down
4 changes: 4 additions & 0 deletions src/components/Redoc/Redoc.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export class Redoc extends React.Component<RedocProps> {
this.props.store.menu.updateOnHash();
}

componentWillUnmount() {
this.props.store.dispose();
}

render() {
const { store: { spec, menu, options } } = this.props;
const store = this.props.store;
Expand Down
2 changes: 1 addition & 1 deletion src/components/SecuritySchemes/SecuritySchemes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export class SecurityDefs extends React.PureComponent<SecurityDefsProps> {
<div>
{this.props.securitySchemes.schemes.map(scheme => (
<div data-section-id={scheme.sectionId} key={scheme.id}>
<H2 id={scheme.sectionId}>
<H2>
<ShareLink href={'#' + scheme.sectionId} />
{scheme.id}
</H2>
Expand Down
2 changes: 1 addition & 1 deletion src/components/SideMenu/SideMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class SideMenu extends ComponentWithOptions<{ menu: MenuStore }> {
<MenuItems
style={{
overflow: 'auto',
'-ms-overflow-style': '-ms-autohiding-scrollbar',
msOverflowStyle: '-ms-autohiding-scrollbar',
}}
items={store.items}
onActivate={this.activate}
Expand Down
4 changes: 3 additions & 1 deletion src/services/MenuStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ export class MenuStore {
return (item as OperationModel).operationId === ptr;
});
}
this.activateAndScroll(item, false);
if (item) {
this.activateAndScroll(item, false);
}
return item !== undefined;
}

Expand Down

0 comments on commit 0253c5d

Please sign in to comment.