fix: approximated not verifying domain, change request type for /agents

route
This commit is contained in:
Rotimi Best
2026-05-21 14:05:37 +01:00
parent c1bbd02f8e
commit ec92fc5083
23 changed files with 179 additions and 176 deletions
@@ -113,9 +113,9 @@
return (part as { errorText?: string }).errorText;
}
const inlineParts = $derived(message.parts.filter((part) => (part as { type?: string }).type === 'text'));
const inlineParts = $derived((message.parts ?? []).filter((part) => (part as { type?: string }).type === 'text'));
const deferredPlanParts = $derived(
message.parts.filter((part) => isDeferredPlanPart(part as Record<string, unknown>))
(message.parts ?? []).filter((part) => isDeferredPlanPart(part as Record<string, unknown>))
);
const hasBubbleContent = $derived(inlineParts.length > 0 || deferredPlanParts.length > 0 || !!messageAttachment);
const showStreamingSpinner = $derived(message.role === 'assistant' && !hasBubbleContent && isStreaming && isLast);
@@ -52,8 +52,10 @@ export async function getOrgSiteInfo(url: URL, cookies: Cookies): Promise<OrgSit
// Custom domain
if (isURLCustomDomain(url)) {
console.log('it is custom domain');
const apiKeyHeaders = getApiKeyHeaders();
const orgs = await getOrgsByCustomDomain(url.host, true, apiKeyHeaders);
console.log('orgs', orgs);
if (!orgs || orgs.length === 0) {
return response;
@@ -294,6 +294,8 @@
});
}
const DOMAIN_POLL_INTERVAL_MS = 15000;
onMount(() => {
if ($currentOrg.customDomain) {
void refreshDomainApex($currentOrg.customDomain);
@@ -304,6 +306,20 @@
$effect(() => {
resetErrors(siteName, customDomain);
});
$effect(() => {
const shouldPoll =
Boolean($currentOrg.customDomain) && currentDomainStatus !== null && currentDomainStatus !== 'verified';
if (!shouldPoll) return;
const interval = window.setInterval(() => {
if (isRefreshing || isCustomDomainLoading || document.hidden) return;
void handleRefreshCustomDomain(true);
}, DOMAIN_POLL_INTERVAL_MS);
return () => window.clearInterval(interval);
});
</script>
<Field.Group class="w-full max-w-md! px-2">
@@ -330,7 +346,7 @@
<Button variant="outline" onclick={handleSaveSiteName} disabled={isLoading}>
{$t('components.settings.domains.update')}
</Button>
<VisitOrgSiteButton />
<VisitOrgSiteButton forceSubdomain />
</Field.Field>
</Field.Set>
@@ -2,6 +2,7 @@
import { browser } from '$app/environment';
import { Button, type ButtonVariant } from '@cio/ui/base/button';
import ArrowUpRightIcon from '@lucide/svelte/icons/arrow-up-right';
import { TENANT_ROOT_DOMAIN } from '@cio/utils/constants';
import { currentOrg, currentOrgDomain } from '$lib/utils/store/org';
import { isMobile } from '$lib/utils/store/useMobile';
import { t } from '$lib/utils/functions/translations';
@@ -12,17 +13,22 @@
isLMS?: boolean;
labelKey?: string;
variant?: ButtonVariant;
forceSubdomain?: boolean;
}
let {
className = '',
isLMS = false,
labelKey = 'settings.subheadings.view_site',
variant = 'default'
variant = 'default',
forceSubdomain = false
}: Props = $props();
let href = $derived.by(() => {
const origin = $currentOrgDomain || (browser ? window.location.origin : '');
const subdomainOrigin = $currentOrg.siteName ? `https://${$currentOrg.siteName}.${TENANT_ROOT_DOMAIN}` : '';
const origin = forceSubdomain
? subdomainOrigin || (browser ? window.location.origin : '')
: $currentOrgDomain || (browser ? window.location.origin : '');
if (!origin) {
return '';