Skip to content

Commit 5bdd792

Browse files
committed
Fix tests
1 parent b8d11c3 commit 5bdd792

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

packages/api/src/providers/ActivityKeyer/ActivityKeyerComposer.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,19 @@ const ActivityKeyerComposer = ({ children }: Readonly<{ children?: ReactNode | u
115115

116116
prevActivitiesRef.current = activities;
117117

118-
if (!newKeys.length) {
119-
return prevActivityKeysStateRef.current;
118+
if (newKeys.length) {
119+
const nextKeys = Object.freeze([...prevActivityKeysStateRef.current[0], ...newKeys]);
120+
const result = Object.freeze([nextKeys]) as readonly [readonly string[]];
121+
122+
prevActivityKeysStateRef.current = result;
123+
124+
return result;
120125
}
121126

122-
const nextKeys = Object.freeze([...prevActivityKeysStateRef.current[0], ...newKeys]);
123-
const result = Object.freeze([nextKeys]) as readonly [readonly string[]];
127+
// New activities were added to existing keys — no new keys, but the keyToActivitiesMap
128+
// was mutated. Return a new tuple reference so context consumers re-render and see the
129+
// updated activities-per-key via getActivitiesByKey.
130+
const result = Object.freeze([prevActivityKeysStateRef.current[0]]) as readonly [readonly string[]];
124131

125132
prevActivityKeysStateRef.current = result;
126133

0 commit comments

Comments
 (0)