fix(entity-review): persist source URLs for WCMS-only profiles
All checks were successful
Deploy Frontend / build-and-deploy (push) Successful in 2m1s
DSPy RAG Evaluation / Layer 1 - Unit Tests (push) Successful in 5m34s
DSPy RAG Evaluation / Layer 2 - DSPy Module Tests (push) Successful in 7m43s
DSPy RAG Evaluation / Layer 3 - Integration Tests (push) Successful in 5m54s
DSPy RAG Evaluation / Layer 4 - Comprehensive Evaluation (push) Successful in 6m58s
DSPy RAG Evaluation / Quality Gate (push) Successful in 1s
All checks were successful
Deploy Frontend / build-and-deploy (push) Successful in 2m1s
DSPy RAG Evaluation / Layer 1 - Unit Tests (push) Successful in 5m34s
DSPy RAG Evaluation / Layer 2 - DSPy Module Tests (push) Successful in 7m43s
DSPy RAG Evaluation / Layer 3 - Integration Tests (push) Successful in 5m54s
DSPy RAG Evaluation / Layer 4 - Comprehensive Evaluation (push) Successful in 6m58s
DSPy RAG Evaluation / Quality Gate (push) Successful in 1s
- Add source_urls to WCMS-only profile detail response
- Update _candidates_by_wcms cache when creating new WCMS-only entries
- Use correct refresh method (fetchWcmsOnlyProfileDetail) after adding source URL
Fixes issue where source URLs added to WCMS-only profiles were not
displayed after page refresh because:
1. The wcms-only-profile/{email} endpoint wasn't returning source_urls
2. The frontend was calling fetchProfileDetail instead of
fetchWcmsOnlyProfileDetail after adding a source URL
3. New WCMS-only entries weren't added to the lookup cache
This commit is contained in:
parent
a31b89f672
commit
b11223277c
2 changed files with 26 additions and 5 deletions
|
|
@ -752,15 +752,20 @@ export default function EntityReviewPage() {
|
||||||
// Hide success message after 3 seconds
|
// Hide success message after 3 seconds
|
||||||
setTimeout(() => setSourceUrlSuccess(null), 3000);
|
setTimeout(() => setSourceUrlSuccess(null), 3000);
|
||||||
|
|
||||||
// Optionally refresh profile (the source URLs aren't displayed yet, but could be in the future)
|
// Refresh profile to show the newly added source URL
|
||||||
await fetchProfileDetail(selectedProfile.ppid);
|
// Use appropriate fetch method based on profile type
|
||||||
|
if (selectedProfile.is_wcms_only && selectedProfile.email) {
|
||||||
|
await fetchWcmsOnlyProfileDetail(selectedProfile.email);
|
||||||
|
} else {
|
||||||
|
await fetchProfileDetail(selectedProfile.ppid);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
setSourceUrlError(err instanceof Error ? err.message : 'Failed to add source');
|
setSourceUrlError(err instanceof Error ? err.message : 'Failed to add source');
|
||||||
} finally {
|
} finally {
|
||||||
setAddingSourceUrl(false);
|
setAddingSourceUrl(false);
|
||||||
}
|
}
|
||||||
}, [selectedProfile, sourceUrl, sourceComment, language, fetchProfileDetail]);
|
}, [selectedProfile, sourceUrl, sourceComment, language, fetchProfileDetail, fetchWcmsOnlyProfileDetail]);
|
||||||
|
|
||||||
// Save review decision
|
// Save review decision
|
||||||
const saveDecision = useCallback(async (decision: 'match' | 'not_match' | 'uncertain') => {
|
const saveDecision = useCallback(async (decision: 'match' | 'not_match' | 'uncertain') => {
|
||||||
|
|
|
||||||
|
|
@ -938,8 +938,19 @@ async def get_wcms_only_profile_detail(email: str):
|
||||||
"last_access": wcms_data.get("last_access"),
|
"last_access": wcms_data.get("last_access"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Build PPID for WCMS-only profiles
|
||||||
|
wcms_only_ppid = f"wcms-only-{wcms_data.get('user_id', email_lower)}"
|
||||||
|
|
||||||
|
# Load candidates to check for source_urls
|
||||||
|
# WCMS-only profiles that have had sources added will be in candidates file
|
||||||
|
load_candidates()
|
||||||
|
source_urls = []
|
||||||
|
if _candidates_by_wcms is not None and wcms_only_ppid in _candidates_by_wcms:
|
||||||
|
source_urls_raw = _candidates_by_wcms[wcms_only_ppid].get('source_urls', [])
|
||||||
|
source_urls = source_urls_raw # Already list of dicts
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ppid": f"wcms-only-{wcms_data.get('user_id', email_lower)}",
|
"ppid": wcms_only_ppid,
|
||||||
"name": name,
|
"name": name,
|
||||||
"email": wcms_data.get("email", email),
|
"email": wcms_data.get("email", email),
|
||||||
"email_domain": email_domain,
|
"email_domain": email_domain,
|
||||||
|
|
@ -949,6 +960,7 @@ async def get_wcms_only_profile_detail(email: str):
|
||||||
"match_candidates": [], # Empty - ready for manual LinkedIn addition
|
"match_candidates": [], # Empty - ready for manual LinkedIn addition
|
||||||
"annotation_date": None,
|
"annotation_date": None,
|
||||||
"is_wcms_only": True, # Flag to indicate this is a WCMS-only profile
|
"is_wcms_only": True, # Flag to indicate this is a WCMS-only profile
|
||||||
|
"source_urls": source_urls, # Include any added source URLs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2702,8 +2714,12 @@ async def add_source_url(request: AddSourceUrlRequest):
|
||||||
'source_urls': [source_observation]
|
'source_urls': [source_observation]
|
||||||
}
|
}
|
||||||
_candidates_cache['candidates'].append(new_entry)
|
_candidates_cache['candidates'].append(new_entry)
|
||||||
|
|
||||||
|
# Also add to the in-memory lookup cache so it can be found on subsequent requests
|
||||||
|
if _candidates_by_wcms is not None:
|
||||||
|
_candidates_by_wcms[wcms_ppid] = new_entry
|
||||||
|
|
||||||
# Also update the wcms lookup cache
|
# Also update the wcms lookup cache (for existing entries)
|
||||||
if _candidates_by_wcms is not None and wcms_ppid in _candidates_by_wcms:
|
if _candidates_by_wcms is not None and wcms_ppid in _candidates_by_wcms:
|
||||||
if 'source_urls' not in _candidates_by_wcms[wcms_ppid]:
|
if 'source_urls' not in _candidates_by_wcms[wcms_ppid]:
|
||||||
_candidates_by_wcms[wcms_ppid]['source_urls'] = []
|
_candidates_by_wcms[wcms_ppid]['source_urls'] = []
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue