-
-
Notifications
You must be signed in to change notification settings - Fork 149
fix(BTabs): correct id/index on ssr #2726
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
base: main
Are you sure you want to change the base?
Conversation
|
WalkthroughThis change refactors tab ID generation and synchronization in the BTabs and BTab components. It updates the Changes
Sequence Diagram(s)sequenceDiagram
participant Parent as BTabs
participant Child as BTab
Child->>Parent: registerTab(tabRef)
Parent->>Child: return tabId
Child->>Child: Update localId if tabId differs
Parent->>Parent: Sort tabs if initialized
Parent->>Parent: Determine initial active tab (skip disabled, respect explicit active)
Assessment against linked issues
Possibly related PRs
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (2)packages/bootstrap-vue-next/src/components/BTabs/BTab.vue (2)
packages/bootstrap-vue-next/src/components/BTabs/BTabs.vue (3)
🧬 Code Graph Analysis (1)packages/bootstrap-vue-next/src/utils/keys.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (8)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes SSR issues in BTabs by correcting id/index assignment and improving the tab registration flow.
- Updated the registerTab signature and usage to return a string id.
- Modified tab id fallback logic and active tab selection in BTabs.vue.
- Adjusted BTabs and BTab component logic to sync computed ids with registered ids.
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/bootstrap-vue-next/src/utils/keys.ts | Updated registerTab signature to return a string id. |
packages/bootstrap-vue-next/src/components/BTabs/BTabs.vue | Improved SSR id/index handling and active tab resolution logic. |
packages/bootstrap-vue-next/src/components/BTabs/BTab.vue | Updated computed id and registration logic to align with new tab id assignment. |
Comments suppressed due to low confidence (1)
packages/bootstrap-vue-next/src/components/BTabs/BTabs.vue:473
- The variable name 'idx2' is ambiguous; consider renaming it to a more descriptive name such as 'matchingTabIndex'.
const idx2 = tabsInternal.value.findIndex((t) => t.value.internalId === tab.value.internalId)
} else if (activeIndex.value === -1 && !activeId.value) { | ||
activeIndex.value = 0 | ||
updateInitialActiveId = true | ||
} else if (activeIndex.value === -1 && !activeId.value && !isChildActive.value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The multiple else-if conditions for determining the active tab make the control flow hard to follow; consider refactoring or adding inline comments to clarify the logic.
Copilot uses AI. Check for mistakes.
commit: |
closes #2723
Describe the PR
A clear and concise description of what the pull request does.
Small replication
A small replication or video walkthrough can help demonstrate the changes made. This is optional, but can help observe the intended changes. A mentioned issue that contains a replication also works.
PR checklist
What kind of change does this PR introduce? (check at least one)
fix(...)
feat(...)
fix(...)
docs(...)
The PR fulfills these requirements:
CHANGELOG
is generated from these messages, and determines the next version type. Pull requests that do not follow conventional commits or do not have an override will be deniedSummary by CodeRabbit
New Features
Bug Fixes