Skip to content

Commit

Permalink
feat: requestIdleCallback works
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuever committed Oct 23, 2023
1 parent 2ab7805 commit 5fea7ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
3 changes: 1 addition & 2 deletions packages/data-model/src/ItemMetaStateEventHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,7 @@ class ItemMetaStateEventHelper {
}).bind(this);

this._callbackId = this._canIUseRIC
? // @ts-ignore TODO----
setTimeout(handler)
? requestIdleCallback(handler)
: handler();
}
}
Expand Down
2 changes: 2 additions & 0 deletions packages/data-model/src/__test__/reducer.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// @ts-ignore eslint-disable-next-line
// import { requestIdleCallback } from './setup'
import createStore from '../state/createStore';
import ListDimensions from '../ListDimensions';
import ListGroupDimensions from '../ListGroupDimensions';
Expand Down
1 change: 1 addition & 0 deletions packages/data-model/src/__test__/setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// export const requestIdleCallback = fn => setTimeout(fn, 0)
4 changes: 2 additions & 2 deletions packages/data-model/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import tsPath from 'vite-tsconfig-paths';
export default defineConfig({
test: {
globals: true,
include: ['src/__test__/**/reducer.test.ts'],
// include: ['src/__test__/**/reducer.test.ts'],
// setupFiles: ['./src/__test__/setup.js'],
// fakeTimers: {
// requestIdleCallback: true,
// }
// include: ['src/__test__/**/reducer.test.ts'],
// include: ['src/__test__/**/ListDimensions.test.ts'],
include: ['src/__test__/**/ListDimensions.test.ts'],
// browser: true,
},

Expand Down

0 comments on commit 5fea7ff

Please sign in to comment.