@@ -70,6 +70,10 @@ export function PlatformFilterClient({platforms}: {platforms: Platform[]}) {
70
70
return matches_ ;
71
71
} , [ filter , platformsAndGuides ] ) ;
72
72
73
+ const matchKeys = useMemo ( ( ) => {
74
+ return matches . map ( x => x . key ) ;
75
+ } , [ matches ] ) ;
76
+
73
77
const platformColumns : Platform [ ] [ ] = splitToChunks (
74
78
3 ,
75
79
uniqByReference ( matches . map ( x => ( x . type === 'platform' ? x : x . platform ) ) ) . map ( p => {
@@ -161,6 +165,7 @@ export function PlatformFilterClient({platforms}: {platforms: Platform[]}) {
161
165
< PlatformWithGuides
162
166
key = { platform . key }
163
167
platform = { platform }
168
+ matchKeys = { matchKeys }
164
169
// force expand if the filter is long enough to have few results
165
170
forceExpand = { filter . length >= 2 }
166
171
/>
@@ -180,11 +185,19 @@ export function PlatformFilterClient({platforms}: {platforms: Platform[]}) {
180
185
function PlatformWithGuides ( {
181
186
platform,
182
187
forceExpand,
188
+ matchKeys,
183
189
} : {
184
190
forceExpand : boolean ;
191
+ matchKeys : string [ ] ;
185
192
platform : Platform ;
186
193
} ) {
187
194
const [ expanded , setExpanded ] = useState ( false ) ;
195
+
196
+ const guides = useMemo ( ( ) => {
197
+ const showPlatformInContent = matchKeys . includes ( platform . key ) ;
198
+ return showPlatformInContent ? [ platform , ...platform . guides ] : platform . guides ;
199
+ } , [ matchKeys , platform ] ) ;
200
+
188
201
return (
189
202
< Collapsible . Root
190
203
className = { styles . CollapsibleRoot }
@@ -217,7 +230,7 @@ function PlatformWithGuides({
217
230
// scrollable if there are more than 8 (arbitrary limit) guides
218
231
data-scrollable = { platform . guides . length >= 8 || platform . integrations . length >= 8 }
219
232
>
220
- { [ platform , ... platform . guides ] . map ( ( guide , i ) => (
233
+ { guides . map ( ( guide , i ) => (
221
234
< Link
222
235
href = { guide . url }
223
236
style = { { textDecoration : 'none' , color : 'var(--foreground) !important' } }
0 commit comments