Skip to content

Commit a4df23e

Browse files
authored
Merge pull request #89 from Meta-Node/fro-316-confidence-is-not-updating-when-changing-the-evaluation-of-a
Fro 316 confidence is not updating when changing the evaluation of a
2 parents eb193ee + 996485c commit a4df23e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/components/ConnectionAndEvaluationStatus.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export const ConnectionAndEvaluationStatus = ({
115115
myConnectionToSubject: inboundConnectionInfo,
116116
myConfidenceValueInThisSubjectRating: confidenceValue,
117117
} = useMyEvaluationsContext({ subjectId });
118+
118119
const authData = useSelector(selectAuthData);
119120

120121
const impactPercentage = useImpactPercentage(auraImpacts, authData?.brightId);

src/components/EvaluationFlow/EvaluationFlow.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ import { useCallback, useEffect, useState } from 'react';
88
import useViewMode from '../../hooks/useViewMode';
99
import { EvaluationCategory, PreferredView } from '../../types/dashboard';
1010
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '../ui/dialog';
11+
import { useDispatch } from '@/store/hooks';
12+
import { connectionsApi } from '@/store/api/connections';
13+
import { profileApi } from '@/store/api/profile';
1114

1215
const EvaluationFlow = ({
1316
showEvaluationFlow,
@@ -40,6 +43,7 @@ const EvaluationFlow = ({
4043
const onSubmitted = useCallback(
4144
async (newRating: number | null | undefined) => {
4245
const myRatingsCount = myRatings?.filter((r) => Number(r.rating)).length;
46+
4347
refreshInboundRatings();
4448
refreshOutboundRatings();
4549
if (!newRating) {

src/components/EvaluationOpNotifications.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import {
1515
} from '../constants';
1616
import { useRefreshEvaluationsContext } from '../contexts/RefreshEvaluationsContext';
1717
import { useSubjectName } from '../hooks/useSubjectName';
18-
import { useSelector } from '../store/hooks';
18+
import { useDispatch, useSelector } from '../store/hooks';
1919
import BrightIdProfilePicture from './BrightIdProfilePicture';
2020
import EvaluationThumb from './Shared/EvaluationThumb';
21+
import { connectionsApi } from '@/store/api/connections';
22+
import { profileApi } from '@/store/api/profile';
2123

2224
type EvaluateOpNotificationData = {
2325
text: string;
@@ -106,6 +108,7 @@ export default function EvaluationOpNotifications() {
106108
const operations = useSelector(selectEvaluateOperations);
107109

108110
const prevOperationsRef = useRef<EvaluateSubmittedOperation[] | null>(null);
111+
const dispatch = useDispatch();
109112

110113
useEffect(() => {
111114
const storedOperations = localStorage.getItem('prevOperations');
@@ -166,6 +169,10 @@ export default function EvaluationOpNotifications() {
166169
prevOperation.state !== operation_states.APPLIED &&
167170
operation.state === operation_states.APPLIED
168171
) {
172+
dispatch(connectionsApi.util.invalidateTags([{ type: 'BrightID' }]));
173+
174+
dispatch(profileApi.util.invalidateTags([{ type: 'BrightID' }]));
175+
169176
addNotification({
170177
operation,
171178
text: `Applied!`,
@@ -186,7 +193,7 @@ export default function EvaluationOpNotifications() {
186193
// Update ref and localStorage with the latest operations
187194
prevOperationsRef.current = operations;
188195
localStorage.setItem('prevOperations', JSON.stringify(operations));
189-
}, [addNotification, operations, refreshEvaluations]);
196+
}, [addNotification, operations, refreshEvaluations, dispatch]);
190197

191198
return (
192199
<div className="w-full">

0 commit comments

Comments
 (0)