Fedora 40 Gnome shell unresponsive while logging off, then login with extra screen plugged in

How to re-produce it?

  1. open the PC and log in.

  2. plug in a extra screen via HDMI (The screen works well still now).

  3. Log out.

  4. Log in.

Then the mouse can move but not click anything. The clock in the top centre will still tick which shows Gnome still work not stuck.

More info

I have install Nvidia driver, and use Wayland session. I can reproduce the bug consistently.