From c4778686ff9be2551d3d8efb84b46a8f3e69b0b7 Mon Sep 17 00:00:00 2001 From: AdairLi Date: Mon, 17 Aug 2026 11:24:20 +0800 Subject: [PATCH] fix(stage-ui): flashing and unreadable validator (#2302) ## Description Fix the flashing validator on the provider setting page which is unable to read and interface. Now it is stable to show the status of the provider and help users to do the further config. ## Linked Issues #2301 ## Summary by CodeRabbit * **Bug Fixes** * Improved credential validation stability by preventing repeated validation for equivalent credential values. * Preserved debounced validation behavior and manual test state resets. --- .../src/composables/use-provider-validation.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/stage-ui/src/composables/use-provider-validation.ts b/packages/stage-ui/src/composables/use-provider-validation.ts index 9bf4573e5..9cd5c8a85 100644 --- a/packages/stage-ui/src/composables/use-provider-validation.ts +++ b/packages/stage-ui/src/composables/use-provider-validation.ts @@ -241,12 +241,18 @@ export function useProviderValidation(providerId: string) { } }) - watch(credentials, () => { + // The synced config store re-applies fresh object snapshots (new references, + // identical content) after every synced action. Watching a serialized signature + // instead of the deep object prevents equivalent snapshots from re-triggering + // validation, which would otherwise loop with markProviderAdded(). + const credentialsSignature = computed(() => JSON.stringify(credentials.value)) + + watch(credentialsSignature, () => { debouncedValidateConfiguration() - // Reset manual test state when credentials change + // Reset manual test state when credentials actually change manualTestPassed.value = false manualTestMessage.value = '' - }, { deep: true }) + }) function handleResetSettings() { const defaultOptions = providerMetadata.value?.defaultConfig ?? {}