Workspaces only on primary display option sometimes doesn't work in multi-monitor setup

Hi everyone,

I have a multi-monitor setup (laptop screen + external screen). I set the external screen as the primary screen:

However, sometimes, when an app is opened on the secondary screen and I switch virtual desktops on the primary screen, the app from the secondary screen gets “attached” to the virtual desktop and disappears when I switch virtual desktops. I recorded a short demo to show this:

output

Restarting helps, but I wonder if a better solution is possible.