If the user exits preview mode before the render response arrives, the
render is still applied to the hidden preview element, causing a stale
preview to appear when switching back to preview mode.
This commit adds a check to ensure the render is only applied if the
user is still in preview mode when the render response is received.