Refactoring to fix next/new behavior in page edit

[#46482189]