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

perf(editor): Use virtual scrolling in RunDataJson.vue #10838

Merged
merged 7 commits into from
Sep 19, 2024

Conversation

RicardoE105
Copy link
Contributor

@RicardoE105 RicardoE105 commented Sep 16, 2024

Summary

Community member suggested to enable virtual scrolling in vue-json-pretty to improve performance when rendering big datasets. There is a massive difference in performance when virtual is enabled.

Before: https://share.cleanshot.com/MF4hyWMN

Now: https://share.cleanshot.com/G2v0kSPg

Related Linear tickets, Github issues, and Community forum posts

GH issue: #7584

Linear ticket: https://linear.app/n8n/issue/ADO-2598/enable-virtual-scrolling-in-node-output

Review / Merge checklist

  • PR title and summary are descriptive. (conventions)
  • Docs updated or follow-up ticket created.
  • Tests included.
  • PR Labeled with release/backport (if the PR is an urgent fix that needs to be backported)

@RicardoE105 RicardoE105 changed the title Use virtual scrolling in RunDataJson.vue perf(editor): Use virtual scrolling in RunDataJson.vue Sep 16, 2024
@RicardoE105 RicardoE105 changed the title perf(editor): Use virtual scrolling in RunDataJson.vue perf(editor): Use virtual scrolling inRunDataJson.vue Sep 16, 2024
@n8n-assistant n8n-assistant bot added n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system labels Sep 16, 2024
@RicardoE105 RicardoE105 changed the title perf(editor): Use virtual scrolling inRunDataJson.vue perf(editor): Use virtual scrolling in RunDataJson.vue Sep 16, 2024
Comment on lines 86 to 87
const jsonDataContainer = this.$refs.jsonDataContainer as HTMLDivElement;
this.jsonDataContainerHeight = jsonDataContainer.offsetHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

have you considered using https://vueuse.org/core/useElementSize/#usage ?

this implementation won't work properly if for some reason the user resizes the screen

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh interesting! Will update it to use it. Thanks for the suggestion. Did not know about it. As you can see, I'm a newbie in the FE.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @r00gm, either that or with manual listener but we need to make sure it's updated when the element is resized.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will apply this PR is merged, as could not get the reference to the div in the template from the setup method. Probably because we are mixing setup method and options API.

Copy link
Contributor

Choose a reason for hiding this comment

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

You should be able, you just need to return it from the setup method but still nice that you did the migration.

Copy link
Contributor

@MiloradFilipovic MiloradFilipovic left a comment

Choose a reason for hiding this comment

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

Added 2 comments

Comment on lines 86 to 87
const jsonDataContainer = this.$refs.jsonDataContainer as HTMLDivElement;
this.jsonDataContainerHeight = jsonDataContainer.offsetHeight;
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @r00gm, either that or with manual listener but we need to make sure it's updated when the element is resized.

Copy link

cypress bot commented Sep 19, 2024

n8n    Run #6954

Run Properties:  status check passed Passed #6954  •  git commit 69b50eb27d: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 RicardoE105 🗃️ e2e/*
Project n8n
Branch Review ado-2598-enable-virtual-scrolling-in-node-output
Run status status check passed Passed #6954
Run duration 04m 42s
Commit git commit 69b50eb27d: 🌳 🖥️ browsers:node18.12.0-chrome107 🤖 RicardoE105 🗃️ e2e/*
Committer Ricardo Espinoza
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 2
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 430
View all changes introduced in this branch ↗︎

Copy link
Contributor

@MiloradFilipovic MiloradFilipovic left a comment

Choose a reason for hiding this comment

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

Nice. Looks good.

Copy link
Contributor

✅ All Cypress E2E specs passed

@RicardoE105 RicardoE105 merged commit f5474ff into master Sep 19, 2024
53 checks passed
@RicardoE105 RicardoE105 deleted the ado-2598-enable-virtual-scrolling-in-node-output branch September 19, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
n8n team Authored by the n8n team ui Enhancement in /editor-ui or /design-system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants