Skip to content

Commit b23f3cb

Browse files
Open small cards by default
1 parent 48418b4 commit b23f3cb

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

packages/cursorless-org-docs/src/docs/contributing/MissingLanguageScopes.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
type ScopeType,
88
type SimpleScopeTypeType,
99
} from "@cursorless/common";
10-
import React, { useState } from "react";
10+
import React, { useEffect, useState } from "react";
1111

1212
export function MissingLanguageScopes(): React.JSX.Element[] {
1313
return Object.keys(languageScopeSupport)
@@ -52,14 +52,19 @@ function renderFacets(
5252
facets: ScopeSupportFacet[],
5353
): React.JSX.Element | null {
5454
const [open, setOpen] = useState(false);
55+
const [scopes, setScopes] = useState<string[]>([]);
5556

56-
const scopes = Array.from(
57-
new Set(
58-
facets.map((f) =>
59-
serializeScopeType(scopeSupportFacetInfos[f].scopeType),
57+
useEffect(() => {
58+
const scopes = Array.from(
59+
new Set(
60+
facets.map((f) =>
61+
serializeScopeType(scopeSupportFacetInfos[f].scopeType),
62+
),
6063
),
61-
),
62-
).sort();
64+
).sort();
65+
setScopes(scopes);
66+
setOpen(scopes.length < 4);
67+
}, []);
6368

6469
if (scopes.length === 0) {
6570
return null;

0 commit comments

Comments
 (0)