fix: prevent infinite re-render loop from issue retry callbacks (#2550)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent c3d3dd3934
commit 3fe5e4004a
7 changed files with 137 additions and 99 deletions
+21
View File
@@ -18,6 +18,7 @@ import {
generateFloatApproximatelyEqualsCustomizer,
getChildrenFromElement,
getDurationString,
ignoreFunctionIdentity,
isHoverableDevice,
isHTMLElement,
isSuperset,
@@ -523,6 +524,26 @@ describe('generateFloatApproximatelyEqualsCustomizer', () => {
});
});
describe('ignoreFunctionIdentity', () => {
it('should treat two functions as equal regardless of identity', () => {
expect(
ignoreFunctionIdentity(
() => 1,
() => 2,
),
).toBe(true);
});
it('should treat a function appearing as a real change', () => {
expect(ignoreFunctionIdentity(() => 1, undefined)).toBe(false);
});
it('should treat a function disappearing as a real change', () => {
expect(ignoreFunctionIdentity(undefined, () => 1)).toBe(false);
});
it('should defer to default equality for non-functions', () => {
expect(ignoreFunctionIdentity(1, 2)).toBeUndefined();
});
});
describe('convertHTTPAdressToWebsocket', () => {
it('should convert http to ws', () => {
expect(convertHTTPAdressToWebsocket('http://example.com')).toBe('ws://example.com');