Issues rendering the Code macro

We recently switched to using the ADF renderer component for some of our macro bodies, which enables built-in Confluence macros to render when nested in our macros like they do normally on a page. This has worked well for some macros, but not for others - one that has a particularly bad issue is the Code macro.

It seems like there is some kind of race condition in the Code macro itself where sometimes it will render as expected:

Screenshot 2023-03-03 at 10.56.31

But sometimes it will render broken:

Screenshot 2023-03-03 at 10.57.59

Would appreciate if perhaps someone from the atlaskit / ADF team could provide some pointers on what is happening here.