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: trigger onFilterResultChanged when filtered #2813

Merged

Conversation

LiuTeiTei
Copy link
Contributor

大纲树现有问题

  1. 在搜索的时候,没有命中搜索结果的节点也会显示出来,但点击后就会消失;
  2. 命中搜索结果的节点虽然展示出来的,但其父节点 Title 前的 icon 还是收起的 icon;
  3. 取消搜索后没有展示全部的节点,但点击后就展示出来,有时点击也不会展示出来,只能刷新页面;
  4. 再次搜索后,命中搜索结果的节点没有变红突出。

复现录屏:

2024-01-04.14.26.31.mov

原因分析

搜索时会修改 TreeNode 内的某些属性,但由于 TreeNode 对象比较复杂,没有触发大纲树中组件的重新渲染。

修复思路

搜索时会额外出发 forceRender 参数的变更,大纲树中组件监听该参数的变更。

@liujuping
Copy link
Collaborator

不太想加 forceRender,有没有更好的办法?

@LiuTeiTei
Copy link
Contributor Author

LiuTeiTei commented Jan 4, 2024

不太想加 forceRender,有没有更好的办法?

加 forceRender 确实不是很好的方案,但我这边没有什么更好的想法了,想问下官方这边有没有别的什么思路?

@LiuTeiTei
Copy link
Contributor Author

如果有搜索的情况下,拖拽和添加新组件时,大纲树的渲染也会有问题。

@liujuping
Copy link
Collaborator

不太想加 forceRender,有没有更好的办法?

加 forceRender 确实不是很好的方案,但我这边没有什么更好的想法了,想问下官方这边有没有别的什么思路?

最好还是根据事件/引擎的 API 来实现,如果的确有 Case 实现不了,可以单独拿出来讨论一下。

@LiuTeiTei LiuTeiTei force-pushed the bugfix/plugin-outline-pane-filter branch from d33829c to 4aa9b3b Compare January 4, 2024 10:10
@CLAassistant
Copy link

CLAassistant commented Jan 4, 2024

CLA assistant check
All committers have signed the CLA.

@LiuTeiTei LiuTeiTei changed the title fix: force render outline-pane after filtered fix: trigger onFilterResultChanged when filtered Jan 4, 2024
@LiuTeiTei LiuTeiTei force-pushed the bugfix/plugin-outline-pane-filter branch from 4aa9b3b to 606662e Compare January 4, 2024 10:11
@LiuTeiTei
Copy link
Contributor Author

最好还是根据事件/引擎的 API 来实现,如果的确有 Case 实现不了,可以单独拿出来讨论一下。

麻烦看下 treeNode.onFilterResultChanged 的使用方式正确吗?

const Tip = common.editorCabin.Tip;
const Title = common.editorCabin.Title;
const { Tip } = common.editorCabin;
const { Title } = common.editorCabin;
Copy link
Collaborator

Choose a reason for hiding this comment

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

这里改成

const { Tip, Title } = common.editorCabin;

@liujuping
Copy link
Collaborator

onFilterResultChanged

OK 的,有一个小的改动,辛苦再改一下。还有签一下 CLA

@LiuTeiTei LiuTeiTei force-pushed the bugfix/plugin-outline-pane-filter branch from 606662e to fc9e70b Compare January 4, 2024 10:20
@LiuTeiTei
Copy link
Contributor Author

OK 的,有一个小的改动,辛苦再改一下。还有签一下 CLA

done~

@liujuping liujuping merged commit e1f3a11 into alibaba:develop Jan 5, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants