Skip to content

Commit

Permalink
address regression for "Adaptive print version shows events with cust…
Browse files Browse the repository at this point in the history
…om eventContent with zero height #7419"
  • Loading branch information
arshaw committed Jul 12, 2024
1 parent 1a0228c commit 205b079
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
7 changes: 7 additions & 0 deletions contrib/react/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export default class FullCalendar extends Component<CalendarOptions, CalendarSta
})
this.calendar.render()

// attaching with .on() will cause this to fire AFTER internal preact rendering did flushSync
this.calendar.on('_beforeprint', () => {
flushSync(() => {
// our `customRenderingMap` state will be flushed at this point
})
})

let lastRequestTimestamp: number | undefined

customRenderingStore.subscribe((customRenderingMap) => {
Expand Down
3 changes: 3 additions & 0 deletions contrib/react/tests/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -721,6 +721,9 @@ it('render custom event JSX during print-mode', (done) => {
const api = calendarRef.current.getApi()
api.trigger('_beforeprint')

// HACK: this timeout is not accurate. printing should not rely on timeout.
// However, the feature ultimately works in live testing when triggering browser printing.
// TODO: refactor synchronicity
setTimeout(() => {
const eventEls = getEventEls(container)
expect(eventEls[0].offsetHeight).toBeGreaterThan(10)
Expand Down

0 comments on commit 205b079

Please sign in to comment.