Skip to content

ROU-11926: Protecting code that is run async #1041

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

Conversation

rugoncalves
Copy link
Contributor

This PR is for protecting the code that is ran asynchronously in the build.
The root cause is a concurrency race with the render, that was optimized in ODC and as such became faster, which caused the async code to run in a moment that the pattern is no longer built, in given conditions. Related with RPM-5839.

What was happening

  • In ODC, there is a scenario where patterns are conditionally rendered based on the value of the isDataFetched property, which is part of an Aggregate or DataAction. Specifically, when a user navigates to another page and then returns using the browser's back button, the page state is restored, including the value of isDataFetched = true.
  • Here’s the issue:
    • When the user returns to the page, the final value of isDataFetched is preserved, causing the associated patterns to be initially built.
    • Once the page is restored, the isDataFetched value is set to false again, which results in the patterns being destroyed.
    • Afterward, as data is fetched, the isDataFetched value becomes true again, causing the patterns to be built again.
  • As the some part of the build is done asynchronously, it was being triggered when the pattern had already been destroyed causing errors in the console, and potential misbehavior.
  • Affected patterns:
    • AnimatedLabel
    • Notification
    • ProgressBar
    • Tabs

What was done

  • Protected the code that is invoked asynchronously, so that it validates if it should run.

Test Steps

  1. Enter the sample page
  2. Validate that the patterns are properly displayed
  3. Navigate to another page
  4. In the other page, click on the "back button" of the browser
  5. Validate that the patterns are being displayed correctly and there are no errors in the console.

Checklist

  • tested locally
  • documented the code
  • clean all warnings and errors of eslint
  • requires changes in OutSystems (if so, provide a module with changes)
  • requires new sample page in OutSystems (if so, provide a module with changes)

@rugoncalves rugoncalves requested a review from a team as a code owner May 21, 2025 17:27
@cssecautomation
Copy link

cssecautomation commented May 21, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

@cssecautomation
Copy link

cssecautomation commented May 21, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

Copy link

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.

3 participants