alitajs / alita

A React framework based on umi.
https://alitajs.com
MIT License
788 stars 85 forks source link

types(keepalive): 修复customTabs时会丢失TabConfig类型的问题 #658

Open tangbzai opened 2 months ago

changeset-bot[bot] commented 2 months ago

⚠️ No Changeset found

Latest commit: ceb561d5cddd00f8b880aa373c0b17d1c224b3f2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

vercel[bot] commented 2 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
alita-alita ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2024 6:56am
xiaohuoni commented 1 month ago

忙改我不敢合,请详细说明发生什么错误,然后给个复现

tangbzai commented 1 month ago

修改说明

  1. 对外暴露 KeepAliveContextProps 类型,让使用者可以通过 import type { KeepAliveContextProps } from 'umi' 导入
  2. 修复了hasCustomTabs: true 时,没有导入 TabConfig 导致 KeepAliveContextPropsupdateTab 方法的第二个参数类型丢失的问题(23行和36行调整到25行到29行)
  3. 因为 TabConfig 继承了 TabPaneProps 所以也需要把 TabPaneProps 放出来 (4-10行,原本这部分是“非自定义tab且开启tab布局时才导入的Tab相关类型”改为“只要开启tab布局就导入 TabPaneProps 如果是非自定义tab 则导入其余所需类型 ”)

复现 配置 tabsLayouthasCustomTabs 即可在 src/.umi/plugin-keepalive/context.tsx 中观察到 复现小demo

xiaohuoni commented 1 month ago

@chj-damon 杰哥,来兜底