Skip to content

FOUR-34484: Calculated Property Using new Date() Causes Infinite Loop and Screen Failure - #1946

Open
rodriquelca wants to merge 3 commits into
developfrom
bugfix/FOUR-34484
Open

rodriquelca wants to merge 3 commits into
developfrom
bugfix/FOUR-34484

Conversation

@rodriquelca

Copy link
Copy Markdown
Contributor

Issue & Reproduction Steps

Expected behavior: A JavaScript calculated property with return new Date() bound to the same variable as a Date Picker shows the date in Preview, stores an ISO string in screen data, and stops recalculating after the first run. Adding controls, submitting the form, and running watchers should not freeze the browser.

Actual behavior: In Preview the value appears in preview data but the Date Picker stays empty. After returning to Design and adding another control (e.g. Line Input), the calc runs in a loop (Calc "form_date_picker_1" has RUN repeatedly) and the tab becomes unresponsive. Same instability can appear on submit or when a watcher runs.

Reproduction:

  1. Create a screen with a Date Picker (form_date_picker_1).
  2. Add a calculated property (JavaScript) on form_date_picker_1 with formula: return new Date().
  3. Open Preview — field is empty while data may show a date.
  4. Return to Design, add a Line Input, open Preview again — infinite calc execution in the console.

(Optional: import screen Calc_Date.json from the ticket.)

Solution

  • In evaluateExpression (src/mixins/computedFields.js), remove the early return in the JavaScript branch introduced in FOUR-13455 so Date results go through the same toISOString() normalization as expression-based calcs.
  • Prevents raw Date objects from reaching the Date Picker and stops the Date ↔ string feedback loop that retriggered the computed property.
loop_date.mov

How to Test

  • please review the steps un the repated Jira ticket

Related Tickets & Packages

Code Review Checklist

  • I have pulled this code locally and tested it on my instance, along with any associated packages.
  • This code adheres to ProcessMaker Coding Guidelines.
  • This code includes a unit test or an E2E test that tests its functionality, or is covered by an existing test.
  • This solution fixes the bug reported in the original ticket.
  • This solution does not alter the expected output of a component in a way that would break existing Processes.
  • This solution does not implement any breaking changes that would invalidate documentation or cause existing Processes to fail.
  • This solution has been tested with enterprise packages that rely on its functionality and does not introduce bugs in those packages.
  • This code does not duplicate functionality that already exists in the framework or in ProcessMaker.
  • This ticket conforms to the PRD associated with this part of ProcessMaker.

@rodriquelca
rodriquelca requested a review from caleeli November 30, 2026 13:29
@rodriquelca rodriquelca changed the title Bugfix/four 34484 FOUR-34484: Calculated Property Using new Date() Causes Infinite Loop and Screen Failure Nov 30, 2026
@decisions-sonarqube

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant