UE5 Enhanced Input Bug after open New Level ?

When I press and hold a button, it will call the start event and wait for me to release it to call the complete event. However, if I open a new level before releasing the button, it will jump to the next level and repeatedly call the start event and complete event until I haev release the button or press another one. How can I solve this problem?

Run a Check (Branch) to make sure you’re still pressing and or if are still pressing

I suppose what I need is to make sure all the input cache is flush after opne new level, currently , right now I use some code like

			if (UEnhancedInputLocalPlayerSubsystem* Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(locP))
			{
				UEnhancedPlayerInput* EnhancedPlayerInput = Subsystem->GetPlayerInput();
				EnhancedPlayerInput->FlushPressedKeys();
				EnhancedPlayerInput->ActionMappings.Empty();
				//controller->FlushPressedKeys();

				FModifyContextOptions op;
				op.bForceImmediately = true;
				op.bIgnoreAllPressedKeysUntilRelease = true;
				Subsystem->AddMappingContext(megaInputContext, 0 , op);
                        }

But I still get the some problem

Hello, it seems to work using this solution for a similar problem attempting flushing pressed key: [Enhanced Input] Inconsistent Behavior when flushing pressed keys