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(Splitter): isCollapsed not working on ssr #1566

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions packages/radix-vue/src/Splitter/SplitterGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ function collapsePanel(panelData: PanelData) {
assert(
panelSize != null,
`Panel size not found for panel "${panelData.id}"`,
`Panel size not found for panel "${panelData.id}"`,
)
if (panelSize !== collapsedSize) {
Expand Down Expand Up @@ -625,7 +625,7 @@ function getPanelSize(panelData: PanelData) {
assert(
panelSize != null,
`Panel size not found for panel "${panelData.id}"`,
`Panel size not found for panel "${panelData.id}"`,
)
return panelSize
Expand All @@ -640,7 +640,16 @@ function isPanelCollapsed(panelData: PanelData) {
panelSize,
} = panelDataHelper(panelDataArray, panelData, layout)
return collapsible === true && panelSize === collapsedSize
if (!collapsible)
return false
// panelSize is undefined during ssr due to vue ssr reactivity limitation.
if (panelSize === undefined) {
return panelData.constraints.defaultSize === panelData.constraints.collapsedSize
}
else {
return panelSize === collapsedSize
}
}
function isPanelExpanded(panelData: PanelData) {
Expand All @@ -654,7 +663,7 @@ function isPanelExpanded(panelData: PanelData) {
assert(
panelSize != null,
`Panel size not found for panel "${panelData.id}"`,
`Panel size not found for panel "${panelData.id}"`,
)
return !collapsible || panelSize > collapsedSize
Expand Down
Loading