mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 23:46:28 +08:00
fix: raf should keep same id (#16370)
This commit is contained in:
parent
59856a093b
commit
fee6b61c19
@ -99,6 +99,10 @@ describe('Test utils function', () => {
|
||||
bamboo = true;
|
||||
}, 3);
|
||||
|
||||
// Do nothing, but insert in the frame
|
||||
// https://github.com/ant-design/ant-design/issues/16290
|
||||
delayRaf(() => {}, 3);
|
||||
|
||||
// Variable bamboo should be false in frame 2 but true in frame 4
|
||||
raf(() => {
|
||||
expect(bamboo).toBe(false);
|
||||
|
@ -17,13 +17,13 @@ export default function wrapperRaf(callback: () => void, delayFrames: number = 1
|
||||
|
||||
if (restFrames <= 0) {
|
||||
callback();
|
||||
delete ids[id];
|
||||
delete ids[myId];
|
||||
} else {
|
||||
ids[id] = raf(internalCallback);
|
||||
ids[myId] = raf(internalCallback);
|
||||
}
|
||||
}
|
||||
|
||||
ids[id] = raf(internalCallback);
|
||||
ids[myId] = raf(internalCallback);
|
||||
|
||||
return myId;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user