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: make panel view as observable #2943

Merged
merged 1 commit into from
Jul 26, 2023
Merged

Conversation

Aaaaash
Copy link
Member

@Aaaaash Aaaaash commented Jul 26, 2023

Types

  • 🐛 Bug Fixes

Background or solution

之前 Panelview 没有使用 observer 包裹,导致内部依赖的 mobx observable 状态更新并不生效,之前看似生效实际只是 re-render 太多顺便刷新

🤖 Generated by Copilot at 0cee758

  • Make panel components reactive to observable state changes using observer function from mobx-react (link, link, link, link)

Changelog

🤖 Generated by Copilot at 0cee758

Improved the main layout UI by making the panel components reactive to the active tab state using the observer function. Modified the file panel.view.tsx in the main-layout package.

@opensumi opensumi bot added the 🐞 bug Something isn't working label Jul 26, 2023
@opensumi
Copy link
Contributor

opensumi bot commented Jul 26, 2023

ChatGPT Code Review:

修改建议:

  • ContainerViewBottomPanelView组件的参数声明中的{}改为observer,示例如下:
const ContainerView: React.FC<{
   component: ComponentRegistryInfo;
   side: string;
   titleMenu: IMenu;
  }> = observer(({ component, titleMenu, side }) => {
   //...
 });

const BottomPanelView: React.FC<{
   component: ComponentRegistryInfo;
   side: string;
   titleMenu: IMenu;
  }> = observer(({ component, titleMenu, side }) => {
   //...
 });

代码功能描述:

  • 组件ContainerView是一个容器视图组件,用于显示一个面板,并将其中的子组件观察为可观察状态。
  • 组件BottomPanelView是一个底部面板视图组件,用于显示一个底部面板,并将其中的子组件观察为可观察状态。
  • 组件RightTabPanelRenderer是一个右边选项卡面板渲染器组件,它使用BaseTabPanelView组件渲染一个包含ContainerView组件的选项卡面板。

@Aaaaash Aaaaash changed the base branch from main to v2.26 July 26, 2023 03:17
@Aaaaash
Copy link
Member Author

Aaaaash commented Jul 26, 2023

/next

@opensumi
Copy link
Contributor

opensumi bot commented Jul 26, 2023

🎉 PR Next version 2.26.3-next-1690341832.0 publish successful! You can install this version via npm install package@2.26.3-next-1690341832.0

2.26.3-next-1690341832.0

@codecov
Copy link

codecov bot commented Jul 26, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (80f849d) 57.62% compared to head (0cee758) 57.62%.

Additional details and impacted files
@@           Coverage Diff           @@
##            v2.26    #2943   +/-   ##
=======================================
  Coverage   57.62%   57.62%           
=======================================
  Files        1337     1337           
  Lines       84145    84145           
  Branches    17487    17487           
=======================================
  Hits        48491    48491           
  Misses      32404    32404           
  Partials     3250     3250           
Flag Coverage Δ
jsdom 52.63% <ø> (ø)
node 16.80% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bytemain
Copy link
Member

[只是 re-render 太多顺便刷新] 那现在不是更多了?

@Aaaaash
Copy link
Member Author

Aaaaash commented Jul 26, 2023

[只是 re-render 太多顺便刷新] 那现在不是更多了?

TabbarHandler 有个 API 叫 updateTitle 用于更新 Panel 的标题,经过之前的一些优化,这些 re-render 没了,导致现在调这个 updateTitle 不会生效,只有切换界面状态触发一次 render 才会更新

@Aaaaash Aaaaash merged commit 3e063a2 into v2.26 Jul 26, 2023
17 checks passed
@Aaaaash Aaaaash deleted the fix/panel-view-observable branch July 26, 2023 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants