Skip to content
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

Fixing Loading Issue and Enhancing Parsing for PM Blocks in Process Reloading and Importing #1646

Merged
merged 16 commits into from
Aug 10, 2023

Conversation

sanjacornelius
Copy link
Contributor

@sanjacornelius sanjacornelius commented Aug 8, 2023

Issue & Reproduction Steps

This PR effectively resolves a loading issue that occurs during reloading a process when a PM Block is configured. Similarly, it tackles an issue arising when importing a process containing a PM Block.

Previously, when a PM Block was loaded, its node type would erroneously convert to a subprocess, disrupting the configuration of the custom inspector panel for that particular PM Block.

Upon investigation, the problem was traced back to the Modeler's createNode method. The underlying parser in this method was inadvertently defaulting to the processmaker-modeler-call-activity instead of the required custom pm-block node.

Test Case A:

  1. Create a PM Block
  2. Create a Process
  3. Add the PM Block to the process
  4. Save the process
  5. Reload the process (you may have to reload multiple times)

Test Case B:

  1. Create a PM Block
  2. Create a Process
  3. Add the PM Block to the process
  4. Save the process
  5. Export the process
  6. Reimport the process

Expected behavior:
The PM Block loads the correct node type

Actual behavior:

The PM Block is converted to the subprocess node type

Solution

  • Implement the correct parsing mechanism for PM Blocks.

How to Test

Test the steps above

ci:package-pm-blocks:observation/FOUR-8887
.

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.

@eiresendez eiresendez self-requested a review August 8, 2023 22:10
The code maintains the existing approach for adding nodes using the setTimeout function, which enhances the asynchronous handling of PM Block creation while ensuring compatibility with the current implementation.
Ensure that the `createNode` function is awaited before committing the node to the store within the `setNode` method. This change prevents timing issues and guarantees that the node is created and ready before proceeding with the store commit.

The `createNode` function was modified to be `async` and `await` the result of node creation before returning. This ensures proper synchronization and prevents unexpected behavior.
In the setNode function, encapsulate the asynchronous logic related to creating nodes within a separate async function called createNodeAsync. This change enhances code organization and readability.

- Moved the creation of nodes and store.commit to createNodeAsync.
- Updated the setNode function to call createNodeAsync for asynchronous operations.
- Kept setNode as a non-async function for consistency.
@ryancooley ryancooley merged commit 625b13f into develop Aug 10, 2023
5 checks passed
@ryancooley ryancooley deleted the observation/FOUR-8887 branch August 10, 2023 01:39
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