Why are viewport units inaccurate when using RenderTexture?

I’ve got a custom mesh that displays an image as a texture and is scaled using the useAspect hook. That mesh is then composed as part of a scene that is rendered within a RenderTexture material. On first render, things look fine, but if you zoom out with the mouse wheel, then resize the screen, the custom mesh suddenly jumps up in size. I investigated the useAspect hook, and under the hood it’s using the useThree hook to access the current viewport sizes and make calculations accordingly. Logging out the viewport sizes shows that the sizes drastically jump up while resizing the window.

Codepen demonstrating the issue

Zoom out with the scroll wheel, then resize the window, and read the console. You should see that the logged out viewport sizes drastically jump up. Can’t figure out what is causing this issue.

Screenshot 2024-08-28 041008