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: right panel container view #4178

Merged
merged 1 commit into from
Nov 22, 2024
Merged

fix: right panel container view #4178

merged 1 commit into from
Nov 22, 2024

Conversation

Ricbet
Copy link
Member

@Ricbet Ricbet commented Nov 20, 2024

Types

  • 🐛 Bug Fixes

Background or solution

因为 tabbarService 是多例的,根据不同的 location 会实例化一个。
之前的代码会导致其他调用方都只会走到 left 这个 tabbarService,从而导致异常

Changelog

修复 right 面板不展示的问题

Summary by CodeRabbit

  • 新功能
    • 更新了标签栏组件的渲染逻辑,增强了与标签栏服务的交互。
    • 引入了更灵活的容器渲染方式,支持动态状态管理。
  • 改进
    • 标签栏服务现在在多个组件中传递,提升了状态更新和拖放事件的处理能力。

@Ricbet Ricbet requested review from hacke2 and erha19 November 20, 2024 09:30
@Ricbet Ricbet self-assigned this Nov 20, 2024
@opensumi opensumi bot added the 🐞 bug Something isn't working label Nov 20, 2024
Copy link
Contributor

coderabbitai bot commented Nov 20, 2024

Walkthrough

此次更改主要集中在 tabbar.view.tsxbar.view.tsx 文件中,涉及标签组件的渲染逻辑和相关服务的更新。在 tabbar.view.tsx 中,AILeftTabbarRenderer 组件的 renderOtherVisibleContainers 函数被修改,以传递 tabbarService 作为额外参数,从而增强可见容器的渲染上下文。同时,AIChatTabRendererWithTab 组件使用了新的渲染器 ChatTabbarRenderer2。在 bar.view.tsx 中,renderContainers 函数的签名也进行了更新,要求传递 tabbarService,以便更好地管理标签状态和行为。

Changes

文件路径 更改摘要
packages/ai-native/src/browser/layout/tabbar.view.tsx 更新了多个组件的渲染逻辑,特别是 renderOtherVisibleContainers 函数和 AIChatTabRendererWithTab 组件的使用。
packages/main-layout/src/browser/tabbar/bar.view.tsx 更新了 ITabbarViewProps 接口和 renderContainers 函数的签名,要求传递 tabbarService 参数。

Possibly related PRs

Suggested labels

🐞 bug

Suggested reviewers

  • bytemain

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning eslint-import-resolver-typescript > [email protected]: Glob versions prior to v9 are no longer supported
error Couldn't find any versions for "@opensumi/ide-dev-tool" that matches "workspace:*"


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
packages/main-layout/src/browser/tabbar/bar.view.tsx (2)

Line range hint 116-171: 建议优化回调函数的依赖项

renderContainers 使用了 useCallback,但依赖数组为空。函数内部使用了 tabbarServicestyles,建议将这些依赖项添加到依赖数组中。

  const renderContainers = React.useCallback(
    (component: ComponentRegistryInfo, tabbarService: TabbarService, currentContainerId?: string) => {
      // ... existing implementation
    },
-   [],
+   [tabbarService, styles, tabClassName],
  );

177-177: 建议优化代码可读性

当前行包含了多个操作,建议拆分为更清晰的步骤以提高可读性。

- {visibleContainers.map((component) => renderContainers(component, tabbarService, currentContainerId))}
+ {visibleContainers.map((component) => {
+   return renderContainers(component, tabbarService, currentContainerId);
+ })}
🧰 Tools
🪛 Biome

[error] 177-177: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 5dccd6a and 460bd08.

📒 Files selected for processing (2)
  • packages/ai-native/src/browser/layout/tabbar.view.tsx (1 hunks)
  • packages/main-layout/src/browser/tabbar/bar.view.tsx (4 hunks)
🧰 Additional context used
🪛 Biome
packages/main-layout/src/browser/tabbar/bar.view.tsx

[error] 177-177: The assignment should not be in an expression.

The use of assignments in expressions is confusing.
Expressions are often considered as side-effect free.

(lint/suspicious/noAssignInExpressions)

🔇 Additional comments (3)
packages/ai-native/src/browser/layout/tabbar.view.tsx (1)

126-126: 通过传递 tabbarService 参数修复了右侧面板显示问题

这个改动确保了每个容器都使用正确的 tabbarService 实例,解决了之前所有调用者都引用左侧实例的问题。请验证右侧面板现在是否能正确显示。

packages/main-layout/src/browser/tabbar/bar.view.tsx (2)

57-61: 接口更新符合预期

renderContainers 函数签名的更新通过添加 tabbarService 参数解决了多实例问题,这与 PR 的目标相符。


315-319: 类型定义更新完善

LeftTabbarRenderer 组件的类型定义更新与整体改动保持一致,确保了类型安全。

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 54.06%. Comparing base (5dccd6a) to head (460bd08).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4178      +/-   ##
==========================================
- Coverage   54.07%   54.06%   -0.01%     
==========================================
  Files        1612     1612              
  Lines       97917    97917              
  Branches    20051    20043       -8     
==========================================
- Hits        52944    52941       -3     
- Misses      37363    37365       +2     
- Partials     7610     7611       +1     
Flag Coverage Δ
jsdom 49.64% <ø> (-0.01%) ⬇️
node 15.56% <ø> (ø)

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.


🚨 Try these New Features:

@Ricbet Ricbet merged commit 5ddaa0b into main Nov 22, 2024
13 checks passed
@Ricbet Ricbet deleted the fix/right-panel-click branch November 22, 2024 02:43
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.

2 participants