processwire-issues icon indicating copy to clipboard operation
processwire-issues copied to clipboard

Page Add preloads all pages

Open Jehfen opened this issue 11 months ago • 3 comments

Short description of the issue

ProcessPageAdd preloads lots of pages. When removing all the "Show in the add-page shortcut menu" in template files, the issue goes away.

Expected behavior

ProcessPageAdd shouldn't preload any pages.

Actual behavior

Showing any admin page that has the "Add New+" button in it takes forever. Example, login takes 18 seconds and debug mode shows that 70.000 pages are loaded!

Optional: Screenshots/Links that demonstrate the issue

Optional: Suggestion for a possible fix

Steps to reproduce the issue

  1. Enable "Show in the add-page shortcut menu" in a template file that is used by lots of pages (50.000+)
  2. Goto the Pages startpage

Setup/Environment

  • ProcessWire version: 3.0.244
  • (Optional) PHP version: 8.3
  • (Optional) MySQL version: Mariadb 10.6
  • (Optional) Any 3rd party modules that are installed and could be related to the issue: None that i can think of, I disabled all extra installed modules, but the issue persisted.

Jehfen avatar Jan 16 '25 10:01 Jehfen

@Jehfen If the "Show in add-page shortcut menu" is requested/enabled, then ProcessPageAdd needs to load pages that can be potential parents in order to verify that they are allowed to show in that menu. It only does this once per login session, as the result is cached for the life of the session. If it is loading 70k pages then it means that you have a ton of potential parents. You'd want to refine your template family settings so that it's not so wide-open in terms of where things can be added. But this is also a case where I would suggest not checking the "Show in add-page shortcut menu" box except for templates where you need it (if any). You can also add your own custom bookmarks to the menu (see last option).

ryancramerdesign avatar Feb 06 '25 14:02 ryancramerdesign

The 70.000 pages are all children; So probably I haven't restricted those child templates for being used as a parent, if I understand it correctly? It looked like it was preloading all the children. Anyways I just unchecked "Show in add-page shortcut menu" for those templates.

Jehfen avatar Feb 06 '25 15:02 Jehfen

This just happened to me doing a ProcessWire version update, unchecking "Show in add-page shorcut menu" solved it for me too.

elabx avatar Feb 06 '25 15:02 elabx