atproto explorer

fix empty properties object

juli.ee 18e51c93 3d3ca0fc

verified
+23 -8
+23 -8
src/components/lexicon-schema.tsx
··· 83 83 const isLocalRef = () => props.refType?.startsWith("#"); 84 84 const isExternalRef = () => props.refType && !props.refType.startsWith("#"); 85 85 86 - const handleClick = async (e: MouseEvent) => { 87 - e.preventDefault(); 86 + const handleClick = async () => { 88 87 if (isLocalRef()) { 89 88 const defName = props.refType!.slice(1); 90 89 window.history.replaceState(null, "", `#schema:${defName}`); ··· 287 286 props.def.closed || 288 287 props.def.items; 289 288 290 - const handleHeaderClick = (e: MouseEvent) => { 291 - e.preventDefault(); 289 + const handleHeaderClick = () => { 292 290 window.history.replaceState(null, "", `#schema:${props.name}`); 293 291 const element = document.getElementById(`def-${props.name}`); 294 292 if (element) { ··· 334 332 </Show> 335 333 336 334 {/* Properties (for record/object types) */} 337 - <Show when={props.def.properties || props.def.record?.properties}> 335 + <Show 336 + when={Object.keys(props.def.properties || props.def.record?.properties || {}).length > 0} 337 + > 338 338 <div class="flex flex-col gap-2"> 339 339 <h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400"> 340 340 Properties ··· 354 354 </Show> 355 355 356 356 {/* Parameters (for query/procedure) */} 357 - <Show when={props.def.parameters?.properties}> 357 + <Show 358 + when={ 359 + props.def.parameters?.properties && 360 + Object.keys(props.def.parameters.properties).length > 0 361 + } 362 + > 358 363 <div class="flex flex-col gap-2"> 359 364 <h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400"> 360 365 Parameters ··· 398 403 <UnionBadges refs={props.def.input!.schema!.refs!} /> 399 404 </div> 400 405 </Show> 401 - <Show when={props.def.input!.schema?.properties}> 406 + <Show 407 + when={ 408 + props.def.input!.schema?.properties && 409 + Object.keys(props.def.input!.schema.properties).length > 0 410 + } 411 + > 402 412 <div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30"> 403 413 <For each={Object.entries(props.def.input!.schema!.properties!)}> 404 414 {([name, property]) => ( ··· 440 450 <UnionBadges refs={props.def.output!.schema!.refs!} /> 441 451 </div> 442 452 </Show> 443 - <Show when={props.def.output!.schema?.properties}> 453 + <Show 454 + when={ 455 + props.def.output!.schema?.properties && 456 + Object.keys(props.def.output!.schema.properties).length > 0 457 + } 458 + > 444 459 <div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30"> 445 460 <For each={Object.entries(props.def.output!.schema!.properties!)}> 446 461 {([name, property]) => (