MCPcopy Index your code
hub / github.com/codeaashu/claude-code / resolveFieldAsync

Function resolveFieldAsync

src/components/mcp/ElicitationDialog.tsx:384–428  ·  view source on GitHub ↗
(fieldName_4: string, schema_2: PrimitiveSchemaDefinition, rawValue: string)

Source from the content-addressed store, hash-verified

382 updateValidationError(fieldName_3, validation_0.isValid ? undefined : validation_0.error);
383 }
384 function resolveFieldAsync(fieldName_4: string, schema_2: PrimitiveSchemaDefinition, rawValue: string) {
385 if (!signal) return;
386
387 // Abort any existing resolution for this field
388 const existing = resolveAbortRef.current.get(fieldName_4);
389 if (existing) {
390 existing.abort();
391 }
392 const controller_0 = new AbortController();
393 resolveAbortRef.current.set(fieldName_4, controller_0);
394 setResolvingFields(prev_1 => new Set(prev_1).add(fieldName_4));
395 void validateElicitationInputAsync(rawValue, schema_2, controller_0.signal).then(result => {
396 resolveAbortRef.current.delete(fieldName_4);
397 setResolvingFields(prev_2 => {
398 const next_1 = new Set(prev_2);
399 next_1.delete(fieldName_4);
400 return next_1;
401 });
402 if (controller_0.signal.aborted) return;
403 if (result.isValid) {
404 setField(fieldName_4, result.value);
405 updateValidationError(fieldName_4);
406 // Update the text input if we're still on this field
407 const isoText = String(result.value);
408 setTextInputValue(prev_3 => {
409 // Only replace if the field is still showing the raw input
410 if (prev_3 === rawValue) {
411 setTextInputCursorOffset(isoText.length);
412 return isoText;
413 }
414 return prev_3;
415 });
416 } else {
417 // Keep raw text, show validation error
418 updateValidationError(fieldName_4, result.error);
419 }
420 }, () => {
421 resolveAbortRef.current.delete(fieldName_4);
422 setResolvingFields(prev_4 => {
423 const next_2 = new Set(prev_4);
424 next_2.delete(fieldName_4);
425 return next_2;
426 });
427 });
428 }
429 function handleTextInputChange(newValue: string) {
430 setTextInputValue(newValue);
431 // Commit immediately on each keystroke (sync validation)

Callers 1

handleNavigationFunction · 0.85

Calls 7

setFieldFunction · 0.85
updateValidationErrorFunction · 0.85
getMethod · 0.65
deleteMethod · 0.65
setMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected