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

feat: Bundle optimization and first load improvements #21667

Merged
merged 129 commits into from
May 11, 2023

Conversation

SatishGandham
Copy link
Contributor

@SatishGandham SatishGandham commented Mar 22, 2023

Description

This is an intermediate branch for the first load optimization

TL;DR

Improves the first load times via bundle optimization, code splitting, and prioritizing delivery of critical code.

Change 1

The Evaluation and Tern workers have several large dependencies:

Change 2

  • switches the build target to modern browsers; this means stuff like class, async/await, etc is not transpiled anymore
  • code-splits away the code editor + sets up ESLint rules to enforce that
  • code-splits away Lottie + sets up ESLint rules to enforce that

In total, this saves 1.34 minified MBs (8.34 → 7 MB), getting rid of these modules (+ making others smaller, thanks to the modern build target):

Fixes # (issue)

if no issue exists, please create an issue and ask the maintainers about this first

Media

A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video

Type of change

First load optimization and some housekeeping stuff.

Test Plan

  • Test icons in icon picker and rest of the application. Check if icons are loading properly and they don't have intermedite blank state.
  • Test code editor how it loads are there any delays in interacting with it, use network throttling when testing.

Checklist:

Dev activity

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • PR is being merged under a feature flag

QA activity:

  • Test plan has been approved by relevant developers
  • Test plan has been peer reviewed by QA
  • Cypress test cases have been added and approved by either SDET or manual QA
  • Organized project review call with relevant stakeholders after Round 1/2 of QA
  • Added Test Plan Approved label after reveiwing all Cypress test

iamakulov and others added 24 commits February 26, 2023 04:22
This doesn’t work yet: postinstall scripts cause a recursive install loop
For some reason, after the Yarn v3 upgrade, some previously omitted TS errors are now visible. This commit fixes them.
During `yarn dedupe`, Yarn settled down on Blueprint Core v3.43.

However, the current version of @blueprintjs/datetime relies on an import from @blueprintjs/core that’s not present in v3.43. In Yarn 1 setup, this used to work due to an accident: @blueprintjs/datetime installed a newer (3.47) version of @blueprintjs/core, which had the necessary import. Now that we deduped the versions, this doesn’t work anymore.

This commit fixes this by upgrading the Blueprint Core to v3.47.
We moved package.json one level higher, and that somehow made webpack preference node_modules/entities over src/entities.

The previous behavior was weird. (I can’t figure out *why* webpack would prefer src/entities, as it wasn’t configured [1] to do so.) But this commit fixes that.

[1] https://github.com/facebook/create-react-app/blob/d960b9e38c062584ff6cfb1a70e1512509a966e7/packages/react-scripts/config/webpack.config.js#L306-L312
This:
- adds `rts` into the list of workspaces
- changes the build steps for `rts` to copy both the global and the workspaces’ node_modules into `dist`
This commit:

- updates the icon names in the IconSelectControl tests. This was done because with the @blueprintjs/icon update, the control now has more icons, so the previous className checks don’t work anymore (now: https://user-images.githubusercontent.com/2953267/222846934-3b8ad6ae-8cf5-4de4-b5d0-cd3b7ef4234e.png; before: https://user-images.githubusercontent.com/2953267/222846936-bae05b25-dfc6-47cc-934d-3c1cb0d4080d.png)

- switches the tests to snapshots: this makes it much easier to update icon names in case of future @blueprintjs/icon upgrades
perf: switch to yarn 3 + dedupe dependencies
@SatishGandham
Copy link
Contributor Author

/perf-test

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4488351778.
Workflow: Performance Tests Workflow.
Commit: ``.
PR: 21667.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=21667&runId=4488351778_1

@SatishGandham
Copy link
Contributor Author

/ok-to-test

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4499321176.
Workflow: Appsmith External Integration Test Workflow.
Commit: ``.
PR: 21667.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=21667&runId=4499321176_1

@somangshu
Copy link
Contributor

/ok-to-test sha=f3e0d4f

@github-actions
Copy link

Tests running at: https://github.com/appsmithorg/appsmith/actions/runs/4935045082.
Workflow: Appsmith External Integration Test Workflow.
Commit: f3e0d4f.
PR: 21667.
Perf tests will be available at https://app.appsmith.com/app/performance-infra-dashboard/pr-details-638dd7cd2913ba43778b915e?pr=21667&runId=4935045082_1

@somangshu
Copy link
Contributor

/build-deploy-preview env=release

@github-actions
Copy link

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

@somangshu
Copy link
Contributor

/build-deploy-preview

@github-actions
Copy link

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

@somangshu
Copy link
Contributor

Build running here

@SatishGandham SatishGandham merged commit 83538ad into release May 11, 2023
@SatishGandham SatishGandham deleted the bundle-optimization branch May 11, 2023 05:26
@SatishGandham SatishGandham restored the bundle-optimization branch May 13, 2023 07:06
@arunvjn arunvjn mentioned this pull request May 15, 2023
17 tasks
arunvjn added a commit that referenced this pull request May 17, 2023
## Description
#22652 introduced new styles
to code in Appsmith. Along with it was some unintentional changes.
Bundle optimization
[PR](#21667) introduced,
CodeEditorFallback component which incorrectly renders borders and
causes UI to flicker. It also broke styles of lint message popover. This
PR fixes these issues.

Code changes
- Added 6px padding to code editor lines
- Use class variables instead of ref
- Removed border for JSEditor's CodeEditorFallback component
- Fixes lint message style
>
> Links to Notion, Figma or any other documents that might be relevant
to the PR
>
https://www.notion.so/appsmith/Visual-changes-to-code-in-Appsmith-8bb530c60ee844e5b44adec039bf9280#d99e8450f022439f845b5a0d7deb1d3f
>
#### PR fixes following issue(s)
Fixes # (issue number)
> if no issue exists, please create an issue and ask the maintainers
about this first
>
>
#### Media
> A video or a GIF is preferred. when using Loom, don’t embed because it
looks like it’s a GIF. instead, just link to the video
>
>
#### Type of change
- Bug fix (non-breaking change which fixes an issue)
>
>
>
## Testing
>
#### How Has This Been Tested?
- [x] Manual
>
>
#### Test Plan
Visual checks to test for changes as per
[this](https://www.notion.so/appsmith/Error-tooltip-for-data-fields-on-property-pane-Needs-design-810cdc489c3e4168a0b1b348730ac98c?utm_content=810cdc48-9c3e-4168-a0b1-b348730ac98c&utm_campaign=TGA9SH07N&n=slack&n=slack_link_unfurl&pvs=6)
Notion doc
>
#### Issues raised during DP testing
None
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [x] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Test-plan-implementation#speedbreaker-features-to-consider-for-every-change)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans/_edit#areas-of-interest)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [x] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

---------

Co-authored-by: Ravi Kumar Prasad <[email protected]>
@iamenrique
Copy link

iamenrique commented May 17, 2023

After merging this PR, is everything in this guide still valid? https://github.com/appsmithorg/appsmith/blob/release/contributions/ClientSetup.md

I noticed node_modules and ESLint configuration are now in a different level. Does this mean the yarn install has to be done in the app/ folder rather than app/client? Also had to change the ESLint configuration manually in IntelliJ (was automatic before).

Cc. @riodeuno

@SatishGandham
Copy link
Contributor Author

You can do yarn install in any folder under app.

We will move all UI related code under client in a couple of weeks.

@iamenrique
Copy link

@SatishGandham Understood. Is there any issue number / branch / PR I can follow to be aware of those updates? Thanks in advance.

@SatishGandham
Copy link
Contributor Author

@iamenrique , #23395

@keyurparalkar keyurparalkar mentioned this pull request Jun 19, 2023
19 tasks
keyurparalkar added a commit that referenced this pull request Jun 19, 2023
## Description
This issue is happening because we are getting lodash library as
`undefined` when we pass it to` derived.value` function here. This is
happening because of the following reason:
* [Bundle optimisation
PR](#21667) introduces a new
plugin called: `babel-plugin-lodash`. It helps in transforming the
imports.
* But this plugin doesn't work on the following pattern: `import _ from
"lodash"`. Here it replaces `_` with `undefined`
[ This
file](https://github.com/appsmithorg/appsmith/blob/3bc50d9632cf269935aed6657092ddb8b7e8c92f/app/client/src/workers/common/JSLibrary/lodash-wrapper.js#L1)
explains the exact scenario that we are facing.
There is also [an open
bug](lodash/babel-plugin-lodash#235) for this
issue on the `babel-plugin-lodash` repository.

This PR imports lodash from the lodash-wrapper instead of directly
importing as follows: `import _ from "lodash"`
>
#### PR fixes following issue(s)
Fixes #23671

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?

- [x] Manual
- [ ] Jest
- [x] Cypress
- should check that value entered in currency field appears in the
actual field
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag


#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed
keyurparalkar added a commit that referenced this pull request Jun 20, 2023
## Description
This issue is happening because we are getting lodash library as
`undefined` when we pass it to` derived.value` function here. This is
happening because of the following reason:
* [Bundle optimisation
PR](#21667) introduces a new
plugin called: `babel-plugin-lodash`. It helps in transforming the
imports.
* But this plugin doesn't work on the following pattern: `import _ from
"lodash"`. Here it replaces `_` with `undefined`
[ This
file](https://github.com/appsmithorg/appsmith/blob/3bc50d9632cf269935aed6657092ddb8b7e8c92f/app/client/src/workers/common/JSLibrary/lodash-wrapper.js#L1)
explains the exact scenario that we are facing.
There is also [an open
bug](lodash/babel-plugin-lodash#235) for this
issue on the `babel-plugin-lodash` repository.

This PR imports lodash from the lodash-wrapper instead of directly
importing as follows: `import _ from "lodash"`
>
#### PR fixes following issue(s)
Fixes #23671

#### Type of change
- Bug fix (non-breaking change which fixes an issue)

## Testing
>
#### How Has This Been Tested?

- [x] Manual
- [ ] Jest
- [x] Cypress
- should check that value entered in currency field appears in the
actual field
>
>
#### Test Plan
> Add Testsmith test cases links that relate to this PR
>
>
#### Issues raised during DP testing
> Link issues raised during DP testing for better visiblity and tracking
(copy link from comments dropped on this PR)
>
>
>
## Checklist:
#### Dev activity
- [x] My code follows the style guidelines of this project
- [x] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] New and existing unit tests pass locally with my changes
- [ ] PR is being merged under a feature flag

#### QA activity:
- [ ] [Speedbreak
features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-)
have been covered
- [ ] Test plan covers all impacted features and [areas of
interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-)
- [ ] Test plan has been peer reviewed by project stakeholders and other
QA members
- [ ] Manually tested functionality on DP
- [ ] We had an implementation alignment call with stakeholders post QA
Round 2
- [ ] Cypress test cases have been added and approved by SDET/manual QA
- [ ] Added `Test Plan Approved` label after Cypress tests were reviewed
- [ ] Added `Test Plan Approved` label after JUnit tests were reviewed

(cherry picked from commit f47b1c8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants