Skip to content

Commit

Permalink
fix: make sure hidden section not appearing in sidebar (#1038)
Browse files Browse the repository at this point in the history
  • Loading branch information
AceTheCreator authored Aug 22, 2024
1 parent 2769648 commit 8381825
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions library/src/containers/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const SidebarContext = React.createContext<{
export const Sidebar: React.FunctionComponent = () => {
const [showSidebar, setShowSidebar] = useState(false);
const asyncapi = useSpec();
const config = useConfig();

const info = asyncapi.info();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand All @@ -23,6 +24,9 @@ export const Sidebar: React.FunctionComponent = () => {
const schemas = components?.schemas().all();
const hasOperations = asyncapi.operations().length > 0;

const showMessages = config.show?.messages;
const showSchemas = config.show?.schemas;

const messagesList = messages?.length > 0 && (
<li className="mb-3 mt-9">
<a
Expand Down Expand Up @@ -85,8 +89,8 @@ export const Sidebar: React.FunctionComponent = () => {
</a>
<OperationsList />
</li>
{messagesList}
{schemasList}
{showMessages && messagesList}
{showSchemas && schemasList}
</>
);

Expand Down

0 comments on commit 8381825

Please sign in to comment.