Skip to content

Commit 7abcd45

Browse files
gwright170George Wright
and
George Wright
authored
[WOM-5377][BpkComponentCalendar] Remove deferCallback for date formatters (#3702)
* remove deferCallback * remove deferCallback from Backpack Calendar --------- Co-authored-by: George Wright <[email protected]>
1 parent b39d427 commit 7abcd45

File tree

5 files changed

+7
-129
lines changed

5 files changed

+7
-129
lines changed

packages/bpk-component-calendar/src/BpkCalendarGrid.tsx

+7-11
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type { ElementType } from 'react';
2020
import { Component } from 'react';
2121

2222
import { cssModules, isDeviceIos } from '../../bpk-react-utils';
23-
import deferCallback from '../../bpk-react-utils/src/deferCallback';
2423

2524
import { addCalendarGridTransition } from './BpkCalendarGridTransition';
2625
import BpkCalendarWeek from './BpkCalendarWeek';
@@ -126,16 +125,13 @@ class BpkCalendarGrid extends Component<Props, State> {
126125
}
127126

128127
componentDidMount(): void {
129-
// Defer expensive date formatting until after render to improve INP.
130-
deferCallback(() =>
131-
this.setState({
132-
calendarMonthWeeks: getCalendar(
133-
this.props.month,
134-
this.props.weekStartsOn,
135-
this.props.formatDateFull,
136-
),
137-
}),
138-
);
128+
this.setState({
129+
calendarMonthWeeks: getCalendar(
130+
this.props.month,
131+
this.props.weekStartsOn,
132+
this.props.formatDateFull,
133+
),
134+
});
139135
}
140136

141137
UNSAFE_componentWillReceiveProps(nextProps: Props) {

packages/bpk-react-utils/src/__mocks__/deferCallback.ts

-29
This file was deleted.

packages/bpk-react-utils/src/deferCallback-test.ts

-49
This file was deleted.

packages/bpk-react-utils/src/deferCallback.ts

-38
This file was deleted.

scripts/jest/setup.js

-2
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,3 @@ jest.doMock('react', () => {
3434
});
3535
global.TextEncoder = TextEncoder;
3636
registerRequireContextHook();
37-
38-
jest.mock('../../packages/bpk-react-utils/src/deferCallback');

0 commit comments

Comments
 (0)