atproto explorer pdsls.dev
atproto tool

fix empty properties object

juli.ee 18e51c93 3d3ca0fc

verified
Changed files
+23 -8
src
components
+23 -8
src/components/lexicon-schema.tsx
···
const isLocalRef = () => props.refType?.startsWith("#");
const isExternalRef = () => props.refType && !props.refType.startsWith("#");
-
const handleClick = async (e: MouseEvent) => {
-
e.preventDefault();
+
const handleClick = async () => {
if (isLocalRef()) {
const defName = props.refType!.slice(1);
window.history.replaceState(null, "", `#schema:${defName}`);
···
props.def.closed ||
props.def.items;
-
const handleHeaderClick = (e: MouseEvent) => {
-
e.preventDefault();
+
const handleHeaderClick = () => {
window.history.replaceState(null, "", `#schema:${props.name}`);
const element = document.getElementById(`def-${props.name}`);
if (element) {
···
</Show>
{/* Properties (for record/object types) */}
-
<Show when={props.def.properties || props.def.record?.properties}>
+
<Show
+
when={Object.keys(props.def.properties || props.def.record?.properties || {}).length > 0}
+
>
<div class="flex flex-col gap-2">
<h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">
Properties
···
</Show>
{/* Parameters (for query/procedure) */}
-
<Show when={props.def.parameters?.properties}>
+
<Show
+
when={
+
props.def.parameters?.properties &&
+
Object.keys(props.def.parameters.properties).length > 0
+
}
+
>
<div class="flex flex-col gap-2">
<h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">
Parameters
···
<UnionBadges refs={props.def.input!.schema!.refs!} />
</div>
</Show>
-
<Show when={props.def.input!.schema?.properties}>
+
<Show
+
when={
+
props.def.input!.schema?.properties &&
+
Object.keys(props.def.input!.schema.properties).length > 0
+
}
+
>
<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">
<For each={Object.entries(props.def.input!.schema!.properties!)}>
{([name, property]) => (
···
<UnionBadges refs={props.def.output!.schema!.refs!} />
</div>
</Show>
-
<Show when={props.def.output!.schema?.properties}>
+
<Show
+
when={
+
props.def.output!.schema?.properties &&
+
Object.keys(props.def.output!.schema.properties).length > 0
+
}
+
>
<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">
<For each={Object.entries(props.def.output!.schema!.properties!)}>
{([name, property]) => (