Skip to content

fix: generate crud queries to have dynamicBindingPathList #40833

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

Merged
merged 2 commits into from
Jun 3, 2025

Conversation

sneha122
Copy link
Contributor

@sneha122 sneha122 commented Jun 2, 2025

Description

Generate CRUD issue fixed where dynamicBindingPathList was not getting added for newly generated actions.

Steps To Reproduce (#40812) Needs to be tested on https://ee-7616.dp.appsmith.com/ as this has reactivity changes

  • Create a CRUD page using the mock postgres db
  • Click on table widget generated, go to the property pane and remove onPageChange event
  • Now in the table, change the page, data should be refreshed automatically.

Steps To Reproduce (#39660)

  • Create a CRUD page using the mock postgres db
  • Change any widget name using the entity explorer rename option or the property pane rename option
  • Note that this changed name is not reflected in any of the queries that uses this widget property

Fixes #40812
or
Fixes Issue URL

Warning

If no issue exists, please create an issue first, and check with the maintainers if the issue is valid.

Automation

/ok-to-test tags="@tag.Datasource"

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/15414265041
Commit: f638e96
Cypress dashboard.
Tags: @tag.Datasource
Spec:


Tue, 03 Jun 2025 11:01:55 UTC

Communication

Should the DevRel and Marketing teams inform users about this change?

  • Yes
  • No

Summary by CodeRabbit

Summary by CodeRabbit

  • Bug Fixes
    • Ensured that dynamic binding paths are preserved when cloning actions from template applications, improving consistency in cloned actions.
  • Tests
    • Added a test to verify dynamic binding paths are correctly handled when creating pages with PostgreSQL datasources.

Copy link
Contributor

coderabbitai bot commented Jun 2, 2025

Walkthrough

A conditional block was added to the cloneActionsFromTemplateApplication method to ensure that the dynamicBindingPathList from a template action's unpublished version is copied to the new action when present. No other logic or control flow was changed.

Changes

File(s) Change Summary
app/server/appsmith-server/src/main/java/.../CreateDBTablePageSolutionCEImpl.java Added logic to copy dynamicBindingPathList from unpublished actions
app/server/appsmith-server/src/test/java/.../CreateDBTablePageSolutionTests.java Added test verifying dynamicBindingPathList presence for PostgreSQL datasource actions

Sequence Diagram(s)

sequenceDiagram
    participant TemplateAction
    participant CreateDBTablePageSolutionCEImpl
    participant NewActionDTO

    TemplateAction->>CreateDBTablePageSolutionCEImpl: cloneActionsFromTemplateApplication()
    CreateDBTablePageSolutionCEImpl->>TemplateAction: Access unpublished action
    alt unpublished action exists
        CreateDBTablePageSolutionCEImpl->>NewActionDTO: Copy dynamicBindingPathList
    end
    CreateDBTablePageSolutionCEImpl-->>NewActionDTO: Return cloned action
Loading

Assessment against linked issues

Objective Addressed Explanation
Preserve dynamicBindingPathList in generated queries (from #40812)

Poem

In the land of code, a binding lost,
Reactivity paid the cost.
But now with a careful clone,
Dynamic paths are not alone!
Queries spring to life anew—
The bug is gone, hooray for you!
🎉✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b7fca0 and f638e96.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check
🔇 Additional comments (1)
app/server/appsmith-server/src/test/java/com/appsmith/server/solutions/CreateDBTablePageSolutionTests.java (1)

460-489: LGTM! Well-structured test for the dynamicBindingPathList fix.

The test method properly validates the core functionality introduced by this PR - ensuring that dynamicBindingPathList is populated for newly generated CRUD actions. The test follows established patterns in the class and uses appropriate assertions.

The test effectively verifies:

  • Page creation with PostgreSQL datasource
  • Correct number of actions generated (4)
  • Each action's dynamicBindingPathList is non-null and non-empty

This directly addresses the issues mentioned in #40812 and #39660 where dynamicBindingPathList was missing from generated CRUD actions.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@sneha122 sneha122 added the ok-to-test Required label for CI label Jun 2, 2025
@github-actions github-actions bot added Bug Something isn't working Deploy Preview Issues found in Deploy Preview High This issue blocks a user from building or impacts a lot of users Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE labels Jun 2, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java (1)

640-643: Preserve dynamicBindingPathList for cloned actions
This conditional correctly ensures the dynamicBindingPathList from the template’s unpublished action is applied to the new ActionDTO. For safety, consider making a defensive copy (e.g. new ArrayList<>(…)) and defaulting to an empty list if the source is null to prevent unintended side-effects.

Can we add a unit or integration test to assert that cloned actions include the expected binding paths?

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c96ea3 and 8b7fca0.

📒 Files selected for processing (1)
  • app/server/appsmith-server/src/main/java/com/appsmith/server/solutions/ce/CreateDBTablePageSolutionCEImpl.java (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: perform-test / client-build / client-build
  • GitHub Check: perform-test / rts-build / build
  • GitHub Check: perform-test / server-build / server-unit-tests
  • GitHub Check: server-unit-tests / server-unit-tests
  • GitHub Check: server-spotless / spotless-check

@sneha122 sneha122 requested a review from NilanshBansal June 2, 2025 13:22
Copy link
Contributor

@NilanshBansal NilanshBansal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sneha122 does this PR need any tests? Other than the test everything else LGTM

@sneha122
Copy link
Contributor Author

sneha122 commented Jun 3, 2025

@sneha122 does this PR need any tests? Other than the test everything else LGTM

We can add cypress tests for this scenario once reactivity changes are pushed to release, I will add this case here for us to handle later whenever we add cypress cases

@sneha122 sneha122 requested a review from NilanshBansal June 3, 2025 06:22
@NilanshBansal
Copy link
Contributor

@sneha122 does this PR need any tests? Other than the test everything else LGTM

We can add cypress tests for this scenario once reactivity changes are pushed to release, I will add this case here for us to handle later whenever we add cypress cases

@sneha122 since we are making changes to cloneActionsFromTemplateApplication() which should be a very common case, do you think adding a unit test for the above change is also helpful?

@sneha122 sneha122 merged commit a98198d into release Jun 3, 2025
45 checks passed
@sneha122 sneha122 deleted the fix/generate-crud-dynamicPathList branch June 3, 2025 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Deploy Preview Issues found in Deploy Preview High This issue blocks a user from building or impacts a lot of users Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Pod Integrations Product Issues related to a specific integration Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Query Widgets & IDE Pod All issues related to Query, JS, Eval, Widgets & IDE
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Generate page from datasource missing dynamicBindingPathList for Queries
2 participants