Skip to content

Commit

Permalink
[WOM-5377][BpkComponentCalendar] Remove deferCallback for date format…
Browse files Browse the repository at this point in the history
…ters (#3702)

* remove deferCallback

* remove deferCallback from Backpack Calendar

---------

Co-authored-by: George Wright <[email protected]>
  • Loading branch information
gwright170 and George Wright authored Jan 10, 2025
1 parent b39d427 commit 7abcd45
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 129 deletions.
18 changes: 7 additions & 11 deletions packages/bpk-component-calendar/src/BpkCalendarGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import type { ElementType } from 'react';
import { Component } from 'react';

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

import { addCalendarGridTransition } from './BpkCalendarGridTransition';
import BpkCalendarWeek from './BpkCalendarWeek';
Expand Down Expand Up @@ -126,16 +125,13 @@ class BpkCalendarGrid extends Component<Props, State> {
}

componentDidMount(): void {
// Defer expensive date formatting until after render to improve INP.
deferCallback(() =>
this.setState({
calendarMonthWeeks: getCalendar(
this.props.month,
this.props.weekStartsOn,
this.props.formatDateFull,
),
}),
);
this.setState({
calendarMonthWeeks: getCalendar(
this.props.month,
this.props.weekStartsOn,
this.props.formatDateFull,
),
});
}

UNSAFE_componentWillReceiveProps(nextProps: Props) {
Expand Down
29 changes: 0 additions & 29 deletions packages/bpk-react-utils/src/__mocks__/deferCallback.ts

This file was deleted.

49 changes: 0 additions & 49 deletions packages/bpk-react-utils/src/deferCallback-test.ts

This file was deleted.

38 changes: 0 additions & 38 deletions packages/bpk-react-utils/src/deferCallback.ts

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,3 @@ jest.doMock('react', () => {
});
global.TextEncoder = TextEncoder;
registerRequireContextHook();

jest.mock('../../packages/bpk-react-utils/src/deferCallback');

0 comments on commit 7abcd45

Please sign in to comment.