Skip to content

feat: filter fc by page#39766

Closed
znamenskii-ilia wants to merge 1 commit intoreleasefrom
feat/39765-filter-fc-by-page
Closed

feat: filter fc by page#39766
znamenskii-ilia wants to merge 1 commit intoreleasefrom
feat/39765-filter-fc-by-page

Conversation

@znamenskii-ilia
Copy link
Contributor

@znamenskii-ilia znamenskii-ilia commented Mar 18, 2025

Description

Fixes #39765

Automation

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

🔍 Cypress test results

Caution

🔴 🔴 🔴 Some tests have failed.
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/13946065065
Commit: 0065e26
Cypress dashboard.
Tags: @tag.AIAgents
Spec:
The following are new failures, please fix them before merging the PR:

  1. cypress/e2e/Regression/ServerSide/GenerateCRUD/MySQL2_Spec.ts
List of identified flaky tests.
Wed, 19 Mar 2025 12:37:46 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • New Features
    • Improved filtering for action options: Now, available actions for queries and JavaScript functions are dynamically refined to show only those pertinent to the active page context.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2025

Walkthrough

This PR updates the selectors in the FunctionCallingConfigControl component by importing getCurrentPageId from the editor selectors. Both selectQueryEntityOptions and selectJsFunctionEntityOptions now retrieve the current page ID and filter the available actions accordingly, ensuring that only actions relevant to the current page are included.

Changes

Files Change Summary
app/client/.../selectors.ts Added getCurrentPageId import; updated selectQueryEntityOptions and selectJsFunctionEntityOptions to filter actions by the current page ID.

Sequence Diagram(s)

sequenceDiagram
    participant Q as selectQueryEntityOptions
    participant J as selectJsFunctionEntityOptions
    participant G as getCurrentPageId
    participant A as Actions List

    Q->>G: Retrieve currentPageId
    G-->>Q: Return currentPageId
    Q->>A: Filter actions (action.config.pageId == currentPageId)
    
    J->>G: Retrieve currentPageId
    G-->>J: Return currentPageId
    J->>A: Filter actions (action.pageId == currentPageId)
Loading

Assessment against linked issues

Objective Addressed Explanation
Filter actions in function call config to only those from the current page (#39765)

Possibly related PRs

Suggested labels

Enhancement, ok-to-test, Query & Widgets Pod

Suggested reviewers

  • jsartisan
  • ApekshaBhosale

Poem

In the code realm, a page ID gleams bright,
Filtering actions with all its might.
A change so clear, no actions stray,
Only the current page holds sway.
Cheers to clean selectors lighting our night!
🎉✨

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.

📜 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 56120d1 and 0065e26.

📒 Files selected for processing (1)
  • app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: client-unit-tests / client-unit-tests
  • GitHub Check: client-lint / client-lint
  • GitHub Check: client-check-cyclic-deps / check-cyclic-dependencies
  • GitHub Check: client-prettier / prettier-check
  • GitHub Check: client-build / client-build
🔇 Additional comments (4)
app/client/src/components/formControls/FunctionCallingConfigControl/components/selectors.ts (4)

8-8: Good addition of the required import.

The import of getCurrentPageId is essential for the page-based filtering logic implemented in this PR.


18-18: Appropriate filtering of query entities by page ID.

The implementation correctly retrieves the current page ID and filters the actions to only include those belonging to the current page, which addresses the issue described in the PR.

Also applies to: 29-29


53-54: Consistent filtering implementation for JS functions.

The implementation maintains consistency by applying the same page-based filtering approach to JavaScript functions. This ensures only functions from the current page are available for selection.

Also applies to: 56-64


29-29:

Details

❓ Verification inconclusive

Verify edge case handling for undefined page ID.

Consider what should happen if currentPageId is undefined or null. Would filtering in this case be too restrictive? It might be worth verifying this behavior.

Also applies to: 57-57


🏁 Script executed:

#!/bin/bash
# Check if there are places where getCurrentPageId might return undefined
# and how the code handles those cases

# Look for places where getCurrentPageId is defined
echo "Searching for getCurrentPageId definition..."
rg -A 10 "export const getCurrentPageId" --type ts

# Look for places where getCurrentPageId is used with potential null checks
echo "Searching for null checks on currentPageId..."
rg "currentPageId(\s+)(\?\.|===\s+null|===\s+undefined|\|\||&&)" --type ts

Length of output: 1285


Attention: Validate Handling for Undefined currentPageId

The current filter

.filter((action) => action.config.pageId === currentPageId)

will exclude all actions if currentPageId is undefined or null. The definition of getCurrentPageId in app/client/src/selectors/editorSelectors.tsx can indeed return an undefined value, and elsewhere (e.g., in app/client/src/ce/selectors/entitiesSelector.ts) a guard (currentPageId && …) is used. Please verify that this strict filtering is intentional. If you expect a different behavior when currentPageId is missing (for example, including all actions instead of excluding them), consider modifying the condition accordingly.

✨ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@github-actions github-actions bot added AI Agents Issues related to agentic solutions on Appsmith Anvil Pod Issue related to Anvil project Task A simple Todo labels Mar 18, 2025
@znamenskii-ilia znamenskii-ilia added the ok-to-test Required label for CI label Mar 18, 2025
@znamenskii-ilia znamenskii-ilia changed the title filter fc by page feat: filter fc by page Mar 18, 2025
@github-actions github-actions bot added the Enhancement New feature or request label Mar 18, 2025
@NilanshBansal NilanshBansal added ok-to-test Required label for CI and removed ok-to-test Required label for CI labels Mar 19, 2025
@znamenskii-ilia
Copy link
Contributor Author

Closed in favor of #39765

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

Labels

AI Agents Issues related to agentic solutions on Appsmith Anvil Pod Issue related to Anvil project Enhancement New feature or request ok-to-test Required label for CI Task A simple Todo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions from other pages being list in function call config

3 participants