Skip to content

Conversation

@discreted66
Copy link
Collaborator

@discreted66 discreted66 commented Dec 8, 2025

PR

fix:修复多端vue2环境下删除tabs切换显示异常

PR Checklist

Please check if your PR fulfills the following requirements:

  • The commit message follows our Commit Message Guidelines
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Summary by CodeRabbit

  • Bug Fixes
    • Fixed ISO8601 date parsing function naming
    • Enhanced tab removal to correctly update the current tab selection when the active tab is removed

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added the bug Something isn't working label Dec 8, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

Walkthrough

This pull request fixes a typo in the utils package by renaming paeseIso8601 to parseIso8601, updates all consumer code to use the corrected function name, and enhances the tabs-mf module's removeItem handler to accept an api parameter and implement logic to select the next appropriate tab when the current tab is removed.

Changes

Cohort / File(s) Summary
Utils package: Date function rename
packages/utils/src/date/index.ts, packages/utils/src/index.ts
Renamed exported function from paeseIso8601 to parseIso8601 to fix typo. Internal parsing logic unchanged; return behavior and implementation remain identical.
Renderless picker: Import update
packages/renderless/src/picker/index.ts
Updated to import and use parseIso8601 instead of the misspelled paeseIso8601 from @opentiny/utils.
Renderless tabs-mf: Remove handler enhancement
packages/renderless/src/tabs-mf/index.ts, packages/renderless/src/tabs-mf/vue.ts
Added api parameter to removeItem handler. Implements logic to compute isCurrent and select the next appropriate tab (or first tab) when the removed item is the current tab, updating state and triggering changeCurrentName via api. Updated call site to pass api parameter.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Tabs-mf logic verification: Ensure the next-tab selection logic handles edge cases correctly (e.g., removing the last tab, single remaining tab, tabs at boundaries).
  • Import completeness: Confirm all usages of the old misspelled function name have been identified and updated across the codebase.

Poem

A typo fixed with gentle care,
And tabs that navigate with flair,
When one is gone, the next takes flight,
The renderless dance—now crystal bright! 🐰✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title mentions fixing display exceptions when deleting tabs in Vue 2 mobile-first environment, which aligns with the main changes in tabs-mf files and the removeItem handler updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3351336 and 6fcdcbd.

📒 Files selected for processing (5)
  • packages/renderless/src/picker/index.ts (2 hunks)
  • packages/renderless/src/tabs-mf/index.ts (2 hunks)
  • packages/renderless/src/tabs-mf/vue.ts (1 hunks)
  • packages/utils/src/date/index.ts (1 hunks)
  • packages/utils/src/index.ts (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (3)
packages/utils/src/date/index.ts (1)
packages/utils/src/index.ts (1)
  • parseIso8601 (22-22)
packages/renderless/src/tabs-mf/vue.ts (1)
packages/renderless/src/tabs-mf/index.ts (1)
  • removeItem (135-178)
packages/renderless/src/picker/index.ts (2)
packages/utils/src/date/index.ts (1)
  • parseIso8601 (59-71)
packages/utils/src/index.ts (1)
  • parseIso8601 (22-22)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: PR E2E Test (pnpm test:e2e3)
🔇 Additional comments (7)
packages/renderless/src/picker/index.ts (2)

13-13: LGTM! Typo fix in import.

The import correctly references the renamed parseIso8601 function (fixing "paese" → "parse").


180-180: LGTM! Usage updated to match corrected function name.

The usage is consistent with the updated import.

packages/renderless/src/tabs-mf/vue.ts (1)

60-60: LGTM! Correctly passes api to removeItem.

The api object is properly passed to enable the new tab selection logic when removing the current tab.

packages/utils/src/date/index.ts (1)

59-71: LGTM! Typo corrected in function name.

The function implementation is unchanged; only the name is corrected from paeseIso8601 to parseIso8601. See the comment on packages/utils/src/index.ts regarding backwards compatibility considerations for the public export.

packages/renderless/src/tabs-mf/index.ts (2)

136-141: LGTM! Core fix for tab deletion display issue.

The implementation correctly:

  1. Captures isCurrent and nextNav before modifying arrays
  2. Prioritizes adjacent tabs (previous first, then next) for selection

153-157: LGTM! Properly handles current tab selection after removal.

The logic correctly updates the active tab when the removed tab was the current one:

  • Falls back through nextNav → first remaining item → empty string
  • Updates both the name (via api.changeCurrentName) and state.currentItem

This addresses the Vue 2 mobile-first display exception mentioned in the PR.

packages/utils/src/index.ts (1)

22-22: Breaking change: Consider adding a deprecated alias for backwards compatibility.

Renaming the export from paeseIso8601 to parseIso8601 is a breaking change. External consumers importing the old name will encounter runtime errors.

Consider adding a deprecated re-export to maintain backwards compatibility:

// In packages/utils/src/date/index.ts, add:
/** @deprecated Use parseIso8601 instead */
export const paeseIso8601 = parseIso8601

Then re-export both names from this file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@zzcr zzcr merged commit 01103de into opentiny:dev Dec 9, 2025
11 checks passed
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