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

fix: JSObject function is not defined error #35035

Merged
merged 1 commit into from
Jul 19, 2024

Conversation

rishabhrathod01
Copy link
Contributor

@rishabhrathod01 rishabhrathod01 commented Jul 18, 2024

Description

  • Add the initial fetch all entity completion to the affectedJSObject logic to make sure the JSObjects are defined on page change

Fixes #34681
Fixed #34933

Automation

/test js

🔍 Cypress test results

Tip

🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
Workflow run: https://github.com/appsmithorg/appsmith/actions/runs/9998917287
Commit: 88f6c63
Cypress dashboard.
Tags: @tag.JS
Spec:


Thu, 18 Jul 2024 22:05:02 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of specific action types to ensure correct identification of affected objects.
    • Enhanced logic to address cases where action types are not included in the predefined set, providing more accurate results.

Copy link
Contributor

coderabbitai bot commented Jul 18, 2024

Walkthrough

The update to getAffectedJSObjectIdsFromJSAction in InferAffectedJSObjects.ts enhances the function by handling ReduxActionTypes.FETCH_ALL_PAGE_ENTITY_COMPLETION actions distinctly. When such an action is detected, it now returns an empty array of IDs with a flag indicating that all objects are affected. Additionally, it ensures proper handling of actions not included in JS_ACTIONS, returning empty IDs and a false flag. This change aims to rectify issues where JSObject functions may not be recognized under specific navigation circumstances.

Changes

File Change Summary
.../InferAffectedJSObjects.ts Enhanced getAffectedJSObjectIdsFromJSAction to handle FETCH_ALL_PAGE_ENTITY_COMPLETION and improved action type checking.

Sequence Diagram(s)

For these changes, generating a sequence diagram isn't necessary because the modifications primarily involve conditional checks and return statements without altering the overall flow or introducing new features.

Assessment against linked issues

Objective (Issue #) Addressed Explanation
Handle ReduxActionTypes.FETCH_ALL_PAGE_ENTITY_COMPLETION correctly (#34681, #34933)
Ensure proper handling of JSObject functions during navigation (#34681)
Fix error <function_name> is not a function in deployed apps (#34933)

Poem

In code's maze, new logic's thread,
Fetched all pages, errors fled.
Functions lost, now found again,
Navigation smooth, without the strain.
Oh, the joy in JS we see,
As bugs are squashed, our code runs free. 🚀


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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 Bug Something isn't working Query & JS Pod Issues related to the query & JS Pod Javascript Product Issues related to users writing javascript in appsmith Help enterprise Requested by Appsmith customers or prospects Integrations Product Issues related to a specific integration Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. JS Objects Issues related to JS Objects Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage Production labels Jul 18, 2024
@rishabhrathod01 rishabhrathod01 added the ok-to-test Required label for CI label Jul 18, 2024
@github-actions github-actions bot added Community Reported issues reported by community members Critical This issue needs immediate attention. Drop everything else labels Jul 18, 2024
@rishabhrathod01 rishabhrathod01 requested a review from vsvamsi1 July 18, 2024 21:31
@rishabhrathod01 rishabhrathod01 marked this pull request as ready for review July 18, 2024 21:32
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

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between d044155 and 88f6c63.

Files selected for processing (1)
  • app/client/src/ce/sagas/InferAffectedJSObjects.ts (1 hunks)
Additional comments not posted (3)
app/client/src/ce/sagas/InferAffectedJSObjects.ts (3)

16-21: Good job handling FETCH_ALL_PAGE_ENTITY_COMPLETION!

The new conditional block correctly handles the ReduxActionTypes.FETCH_ALL_PAGE_ENTITY_COMPLETION action by returning an object with empty IDs and a flag set to true. This ensures that all JSObjects are considered affected when this action occurs.


22-29: Great check for action types!

The logic to check if the action type is included in JS_ACTIONS is well-implemented. It ensures that only relevant actions are processed, returning an empty array of IDs and a false flag for other actions.


Line range hint 41-52:
Function getAffectedJSObjectIdsFromBufferedAction looks good!

The function correctly handles buffered actions and returns the affected JSObjects or an empty array with a false flag when the action type is not ReduxActionTypes.BUFFERED_ACTION.

@rishabhrathod01
Copy link
Contributor Author

/build-deploy-preview skip-tests=true

Copy link

Deploying Your Preview: https://github.com/appsmithorg/appsmith/actions/runs/10003095945.
Workflow: On demand build Docker image and deploy preview.
skip-tests: true.
env: ``.
PR: 35035.
recreate: .

Copy link

Deploy-Preview-URL: https://ce-35035.dp.appsmith.com

@rishabhrathod01 rishabhrathod01 merged commit 404e6e6 into release Jul 19, 2024
51 checks passed
@rishabhrathod01 rishabhrathod01 deleted the fix/jsObjectFuncUndefined branch July 19, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Community Reported issues reported by community members Critical This issue needs immediate attention. Drop everything else Help enterprise Requested by Appsmith customers or prospects Integrations Pod General Issues related to the Integrations Pod that don't fit into other tags. Integrations Product Issues related to a specific integration Javascript Product Issues related to users writing javascript in appsmith JS Objects Issues related to JS Objects Medium Issues that frustrate users due to poor UX Needs Triaging Needs attention from maintainers to triage ok-to-test Required label for CI Production Query & JS Pod Issues related to the query & JS Pod
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Error <function_name> is not a function in deployed app [Bug]: <JSObject function> is not a function
2 participants