diff --git a/src/index.tsx b/src/index.tsx index b30359d..92bf976 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -63,6 +63,13 @@ export default class FullCalendar extends Component { + flushSync(() => { + // our `customRenderingMap` state will be flushed at this point + }) + }) + let lastRequestTimestamp: number | undefined customRenderingStore.subscribe((customRenderingMap) => { diff --git a/tests/index.jsx b/tests/index.jsx index 9dcd50d..d05ff0a 100644 --- a/tests/index.jsx +++ b/tests/index.jsx @@ -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)