+19
-4
src/views/record.tsx
+19
-4
src/views/record.tsx
···
59
59
}
60
60
61
61
const didDocument = await didDocPromise;
62
-
63
62
const pdsEndpoint = getPdsEndpoint(didDocument);
64
63
65
64
if (!pdsEndpoint) {
···
199
198
const [validSchema, setValidSchema] = createSignal<boolean | undefined>(undefined);
200
199
const [schema, setSchema] = createSignal<ResolvedSchema>();
201
200
const [lexiconNotFound, setLexiconNotFound] = createSignal<boolean>();
201
+
const [remoteValidation, setRemoteValidation] = createSignal<boolean>();
202
202
const did = params.repo;
203
203
let rpc: Client;
204
204
···
250
250
251
251
const validateRemoteSchema = async (record: Record<string, unknown>) => {
252
252
try {
253
+
setRemoteValidation(true);
253
254
const { resolved, failed } = await resolveAllLexicons(params.collection as Nsid);
254
255
255
256
if (failed.size > 0) {
···
274
275
setValidSchema(false);
275
276
setValidationError(err.message || String(err));
276
277
}
278
+
setRemoteValidation(false);
277
279
};
278
280
279
281
const verifyRecordIntegrity = async () => {
···
518
520
></span>
519
521
</div>
520
522
<Show when={validRecord() === false}>
521
-
<div class="wrap-break-word">{verifyError()}</div>
523
+
<div class="text-xs wrap-break-word">{verifyError()}</div>
522
524
</Show>
523
525
</div>
524
526
<div>
···
530
532
"iconify lucide--check text-green-500 dark:text-green-400":
531
533
validSchema() === true,
532
534
"iconify lucide--x text-red-500 dark:text-red-400": validSchema() === false,
533
-
"iconify lucide--loader-circle animate-spin": validSchema() === undefined,
535
+
"iconify lucide--loader-circle animate-spin":
536
+
validSchema() === undefined && remoteValidation(),
534
537
}}
535
538
></span>
536
539
</div>
537
540
<Show when={validSchema() === false}>
538
-
<div class="wrap-break-word">{validationError()}</div>
541
+
<div class="text-xs wrap-break-word">{validationError()}</div>
542
+
</Show>
543
+
<Show
544
+
when={
545
+
!remoteValidation() &&
546
+
validSchema() === undefined &&
547
+
params.collection &&
548
+
!(params.collection in lexicons)
549
+
}
550
+
>
551
+
<Button onClick={() => validateRemoteSchema(record()!.value)}>
552
+
Validate remotely
553
+
</Button>
539
554
</Show>
540
555
</div>
541
556
<Show when={lexiconUri()}>