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: optimize editor performance and resolve freezing issues #4805

Merged
merged 2 commits into from
Nov 2, 2023

Conversation

LIlGG
Copy link
Member

@LIlGG LIlGG commented Nov 1, 2023

What type of PR is this?

/kind bug

What this PR does / why we need it:

优化了编辑器的性能,并解决了卡死现象。具体措施如下:

  1. 编辑器异步加载时,由于其 component 并不会使用响应式,所以也无需进行代理,因此使用 markRaw 将其转为普通对象,可以优化 vue 性能。
  2. 由于 DefaultEditor 有多个根节点导致透传的 attrs 无法设置,因此新增一个 div 节点将其原有节点包裹。参见 https://cn.vuejs.org/guide/components/attrs.html#attribute-inheritance-on-multiple-root-nodes
  3. 原有编辑器实例在切换路由之后不会释放,此次修改之后,将在 vue 的 onBeforeUnmount 时间中手动释放编辑器实例。

How to test it?

  1. 新建文章,新建一个表格。
  2. 不要保存,点击文章路由跳出编辑器界面,再次点击上一次所编辑器的文章,查看是否会卡死。

Which issue(s) this PR fixes:

Fixes #4798

Does this PR introduce a user-facing change?

优化编辑器性能并解决切换页面所造成的卡死现象。

@f2c-ci-robot f2c-ci-robot bot added kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Nov 1, 2023
@f2c-ci-robot f2c-ci-robot bot requested review from lan-yonghui and ruibaby November 1, 2023 03:54
@LIlGG
Copy link
Member Author

LIlGG commented Nov 1, 2023

/area console
/area editor
/milestone 2.11.x
/cherrypick release-2.10

@halo-dev-bot
Copy link
Collaborator

@LIlGG: once the present PR merges, I will cherry-pick it on top of release-2.10 in a new PR and assign it to you.

In response to this:

/area console
/area editor
/milestone 2.11.x
/cherrypick release-2.10

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@f2c-ci-robot f2c-ci-robot bot added the area/console Issues or PRs related to the Halo Console label Nov 1, 2023
@f2c-ci-robot f2c-ci-robot bot added this to the 2.11.x milestone Nov 1, 2023
@f2c-ci-robot f2c-ci-robot bot added the area/editor Issues or PRs related to the Editor label Nov 1, 2023
Copy link

codecov bot commented Nov 1, 2023

Codecov Report

Merging #4805 (3444329) into main (b9c0a1f) will not change coverage.
The diff coverage is n/a.

@@            Coverage Diff            @@
##               main    #4805   +/-   ##
=========================================
  Coverage     61.49%   61.49%           
  Complexity     2805     2805           
=========================================
  Files           405      405           
  Lines         14804    14804           
  Branches       1030     1030           
=========================================
  Hits           9103     9103           
  Misses         5205     5205           
  Partials        496      496           

Copy link
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/lgtm

@f2c-ci-robot f2c-ci-robot bot added the lgtm Indicates that a PR is ready to be merged. label Nov 1, 2023
Copy link

f2c-ci-robot bot commented Nov 1, 2023

New changes are detected. LGTM label has been removed.

@f2c-ci-robot f2c-ci-robot bot removed the lgtm Indicates that a PR is ready to be merged. label Nov 1, 2023
@ruibaby ruibaby added the lgtm Indicates that a PR is ready to be merged. label Nov 1, 2023
Copy link
Member

@guqing guqing 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
Member

@ruibaby ruibaby left a comment

Choose a reason for hiding this comment

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

/approve

Copy link

f2c-ci-robot bot commented Nov 2, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ruibaby

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@f2c-ci-robot f2c-ci-robot bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 2, 2023
@f2c-ci-robot f2c-ci-robot bot merged commit 691cd38 into halo-dev:main Nov 2, 2023
2 checks passed
@JohnNiang JohnNiang modified the milestones: 2.11.x, 2.11.0 Nov 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/console Issues or PRs related to the Halo Console area/editor Issues or PRs related to the Editor kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

新建文章,切换页面,必卡死
5 participants