#3632735: Memoize getErrors() and hasVisitedPage() per request

The per-request memo has been added to WebformNavigationHelper.php.

$errorsMemo holds the unserialized latest errors per sid. $visitedPagesMemo holds visited pages per sid, as a [sid][page] => TRUE map.

hasVisitedPage(): the first call for a sid loads every visited page for that submission in one query. After that it only checks the memo.

getErrors(): it runs the errors query once per sid and then reuses the memo for both the full and per-page results.

logPageVisit(): after the insert, it marks the page as visited in the memo.

logErrors(): after the insert, it replaces the memo with the new errors.

deleteSubmissionLogs(): it clears the errors memo. It clears the visited-pages memo too, unless $keep_visited is true. The memo is keyed by sid only, since a submission ID already identifies its webform.

Edited by Shubham Goel

Merge request reports

Loading
Loading