Skip to content

chore: cache dependencyMap computation on client#35965

Merged
dvj1988 merged 39 commits intoreleasefrom
chore/cache-eval-computation-results
Oct 15, 2024
Merged

chore: cache dependencyMap computation on client#35965
dvj1988 merged 39 commits intoreleasefrom
chore/cache-eval-computation-results

Conversation

@dvj1988
Copy link

@dvj1988 dvj1988 commented Aug 29, 2024

Description

This PR includes the changes to enable browser side caching of dependency map in published mode.

Fixes #Issue Number
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.All"

🔍 Cypress test results

Tip

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


Tue, 15 Oct 2024 07:42:33 UTC

Communication

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

  • Yes
  • No

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced asynchronous profiling for web worker operations, enhancing telemetry capabilities.
    • Updated handling of the EVAL_TREE action to support asynchronous processing, improving performance.
    • Added a caching mechanism for computation results, optimizing data retrieval and management.
  • Bug Fixes

    • Improved accuracy of applicationId extraction for fetching published page resources.
  • Tests

    • Enhanced test cases for DataTreeEvaluator and caching mechanisms to reflect realistic application states.
  • Chores

    • Updated various components to support new asynchronous logic and caching properties.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 29, 2024

Walkthrough

The changes introduced in this pull request enhance the telemetry and evaluation processes within the application by implementing asynchronous handling and caching mechanisms. Key modifications include the addition of the profileAsyncFn function for profiling asynchronous operations, updates to the evalTree function to support asynchronous requests, and the introduction of caching properties in various components. These adjustments collectively improve the application's ability to manage asynchronous evaluations and telemetry data effectively.

Changes

File Path Change Summary
app/client/src/UITelemetry/generateWebWorkerTraces.ts Added profileAsyncFn for profiling asynchronous functions; modified newWebWorkerSpanData to have default attributes.
app/client/src/ce/sagas/PageSagas.tsx Updated fetchPublishedPageResourcesSaga to derive applicationId from the response instead of using an empty string.
app/client/src/ce/workers/Evaluation/evalWorkerActions.ts Moved EVAL_TREE from synchronous to asynchronous actions, indicating a shift to non-blocking processing.
app/client/src/pages/AppViewer/index.tsx Added dispatch for updateCurrentPage action before setupPublishedPage.
app/client/src/sagas/EvaluationsSaga.test.ts Added new selectors and properties to cacheProps for improved state management in tests.
app/client/src/sagas/EvaluationsSaga.ts Integrated new selectors into the evaluation process, enhancing context during evaluations.
app/client/src/workers/Evaluation/__tests__/evaluation.test.ts Updated test for DataTreeEvaluator to include asynchronous setup with additional parameters.
app/client/src/workers/Evaluation/evalTreeWithChanges.test.ts Enhanced beforeEach setup for tests with additional parameters for DataTreeEvaluator.
app/client/src/workers/Evaluation/handlers/evalTree.ts Changed evalTree from synchronous to asynchronous, updating its logic to handle asynchronous telemetry profiling.
app/client/src/workers/Evaluation/handlers/index.ts Removed EVAL_TREE from synchronous handler map and added it to asynchronous handler map.
app/client/src/workers/Evaluation/types.ts Added cacheProps property to EvalTreeRequestData interface for improved caching management.
app/client/src/workers/common/AppComputationCache/AppComputationCache.test.ts Introduced unit tests for AppComputationCache class, covering various caching scenarios.
app/client/src/workers/common/AppComputationCache/index.ts Implemented AppComputationCache class for managing computation caching using localforage.
app/client/src/workers/common/AppComputationCache/types.ts Defined EComputationCacheName enum and ICacheProps interface for cache management.
app/client/src/workers/common/DataTreeEvaluator/index.ts Updated setupFirstTree to be asynchronous and accept cacheProps, enhancing caching behavior.
app/client/src/workers/common/DataTreeEvaluator/test.ts Modified test setup for DataTreeEvaluator to reflect asynchronous changes and realistic application state.
app/client/src/workers/common/DependencyMap/index.ts Changed createDependencyMap to be asynchronous, adding caching logic and error handling.

Possibly related PRs

Poem

In the realm of code, where changes flow,
Asynchronous magic begins to grow.
With caching and profiles, we dance with delight,
Enhancing our app, making it bright!
From trees to actions, all now in sync,
Together we build, and together we think! 🌟


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>, 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 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 the skip-changelog Adding this label to a PR prevents it from being listed in the changelog label Aug 29, 2024
@github-actions
Copy link

github-actions bot commented Sep 6, 2024

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Sep 6, 2024
@dvj1988
Copy link
Author

dvj1988 commented Sep 9, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

github-actions bot commented Sep 9, 2024

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

@github-actions
Copy link

github-actions bot commented Sep 9, 2024

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

@dvj1988 dvj1988 changed the title chore: cache allKeys and dependencyMap computation on client chore: cache dependencyMap computation on client Sep 9, 2024
@dvj1988 dvj1988 added the ok-to-test Required label for CI label Sep 9, 2024
@dvj1988 dvj1988 force-pushed the chore/cache-eval-computation-results branch from 63d01a9 to 5a2244c Compare September 9, 2024 09:44
@github-actions github-actions bot removed the Stale label Sep 9, 2024
@dvj1988
Copy link
Author

dvj1988 commented Sep 10, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

@dvj1988
Copy link
Author

dvj1988 commented Sep 10, 2024

/build-deploy-preview skip-tests=true

Diljit VJ added 2 commits September 20, 2024 17:59
@dvj1988
Copy link
Author

dvj1988 commented Sep 20, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

@github-actions
Copy link

This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected.

@github-actions github-actions bot added the Stale label Sep 28, 2024
@dvj1988
Copy link
Author

dvj1988 commented Sep 30, 2024

Still on-going

@dvj1988
Copy link
Author

dvj1988 commented Oct 14, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

@dvj1988
Copy link
Author

dvj1988 commented Oct 15, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

@dvj1988
Copy link
Author

dvj1988 commented Oct 15, 2024

/build-deploy-preview skip-tests=true

@github-actions
Copy link

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

@github-actions
Copy link

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

@rishabhrathod01
Copy link
Contributor

@dvj1988 please let me know once the PR is ready for review.

@dvj1988
Copy link
Author

dvj1988 commented Oct 15, 2024

@dvj1988 please let me know once the PR is ready for review.

@rishabhrathod01 Changes are complete and its ready for review.

Copy link
Contributor

@rajatagrawal rajatagrawal left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@rishabhrathod01 rishabhrathod01 left a comment

Choose a reason for hiding this comment

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

LGTM

@dvj1988 dvj1988 merged commit a8e6252 into release Oct 15, 2024
@dvj1988 dvj1988 deleted the chore/cache-eval-computation-results branch October 15, 2024 15:35
github-actions bot pushed a commit to Zeral-Zhang/appsmith that referenced this pull request Oct 17, 2024
## Description
This PR includes the changes to enable browser side caching of dependency map in published mode.


Fixes #`Issue Number`  
_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.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/11338708443>
> Commit: af545a2
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=11338708443&attempt=3"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Tue, 15 Oct 2024 07:42:33 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [x] No


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

- **New Features**
- Introduced asynchronous profiling for web worker operations, enhancing
telemetry capabilities.
- Updated handling of the `EVAL_TREE` action to support asynchronous
processing, improving performance.
- Added a caching mechanism for computation results, optimizing data
retrieval and management.

- **Bug Fixes**
- Improved accuracy of `applicationId` extraction for fetching published
page resources.

- **Tests**
- Enhanced test cases for `DataTreeEvaluator` and caching mechanisms to
reflect realistic application states.

- **Chores**
- Updated various components to support new asynchronous logic and
caching properties.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Rishabh-Rathod <rishabh.rathod@appsmith.com>
@coderabbitai coderabbitai bot mentioned this pull request Dec 23, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ok-to-test Required label for CI skip-changelog Adding this label to a PR prevents it from being listed in the changelog Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants