You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With Octane enabled, the Form Task configuration panel in the Modeler repeats the Assignee Permissions section (Escalate To Manager / Assignee Manager Escalation). Each page load that fires ModelerStarting in the same worker adds one more copy.
Cause:package-advanced-user-manager calls GlobalScripts::addScript('.../js/global.js') on every ModelerStarting event. GlobalScriptsManager is a singleton that Octane warms and does not flush, so the same path builds up across requests. The layout prints one <script> tag per entry, and each run of global.js adds the toggles to ProcessMaker.modeler.configurables again.
Steps to reproduce (Octane running, package-advanced-user-manager installed):
Go to Designer and open any process.
Add or select a Form Task and open the Configuration panel.
Find the Assignee Permissions section.
Reload the page (or open a request or case detail, which also fires ModelerStarting) and select the task again.
Assignee Permissions now appears twice, and one more time after each reload.
Solution
GlobalScriptsManager::addScript() now skips a script that is already registered. Octane workers no longer output duplicate script tags.
Added tests/unit/ProcessMaker/Managers/GlobalScriptsManagerTest.php to cover the duplicate case.
How to Test
Run herd php artisan octane:reload (a worker that is already running keeps the old registry).
Open a process in the Modeler, select a Form Task, and open Configuration.
Check that there is only oneAssignee Permissions section, with Escalate To Manager and Assignee Manager Escalation listed once each.
Reload the page several times, open a request or case detail, then go back to the Modeler. There should still be only one section.
Optional: view the page source and confirm package-advanced-user-manager/js/global.js appears only once.
Run php vendor/bin/phpunit tests/unit/ProcessMaker/Managers/GlobalScriptsManagerTest.php.
Low Risk
Small guard in a singleton registry with unit test coverage; no auth or data-path changes.
Overview
Under Laravel Octane, GlobalScriptsManager::addScript() now skips paths already in the registry (strict in_array check), so warmed workers no longer accumulate duplicate global script entries when event listeners run on each request.
That stops duplicate <script> tags and repeated client-side registration (e.g. duplicate Assignee Permissions in the Modeler). A unit test asserts duplicate adds are ignored while distinct scripts still register.
Reviewed by Cursor Bugbot for commit 81540e3. Bugbot is set up for automated code reviews on this repo. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue & Reproduction Steps
With Octane enabled, the Form Task configuration panel in the Modeler repeats the Assignee Permissions section (Escalate To Manager / Assignee Manager Escalation). Each page load that fires
ModelerStartingin the same worker adds one more copy.Cause:
package-advanced-user-managercallsGlobalScripts::addScript('.../js/global.js')on everyModelerStartingevent.GlobalScriptsManageris a singleton that Octane warms and does not flush, so the same path builds up across requests. The layout prints one<script>tag per entry, and each run ofglobal.jsadds the toggles toProcessMaker.modeler.configurablesagain.Steps to reproduce (Octane running,
package-advanced-user-managerinstalled):ModelerStarting) and select the task again.Solution
GlobalScriptsManager::addScript()now skips a script that is already registered. Octane workers no longer output duplicate script tags.tests/unit/ProcessMaker/Managers/GlobalScriptsManagerTest.phpto cover the duplicate case.How to Test
herd php artisan octane:reload(a worker that is already running keeps the old registry).package-advanced-user-manager/js/global.jsappears only once.php vendor/bin/phpunit tests/unit/ProcessMaker/Managers/GlobalScriptsManagerTest.php.Related Tickets & Packages
https://processmaker.atlassian.net/browse/FOUR-34515
Code Review Checklist
ci:deploy