mirror of
https://github.com/mattermost/focalboard.git
synced 2025-01-08 15:06:08 +02:00
fix javascript error when curren group is delete (#3900)
* fix javascript error when curren group is delete * fix test error
This commit is contained in:
parent
a69b0a44dc
commit
9e2043fd76
@ -66,12 +66,7 @@ const Kanban = (props: Props) => {
|
||||
}
|
||||
}, [activeView.fields.defaultTemplateId])
|
||||
|
||||
if (!groupByProperty) {
|
||||
Utils.assertFailure('Board views must have groupByProperty set')
|
||||
return <div/>
|
||||
}
|
||||
|
||||
const propertyValues = groupByProperty.options || []
|
||||
const propertyValues = groupByProperty?.options || []
|
||||
Utils.log(`${propertyValues.length} propertyValues`)
|
||||
|
||||
const visiblePropertyTemplates = useMemo(() => {
|
||||
@ -168,7 +163,7 @@ const Kanban = (props: Props) => {
|
||||
}, [cards, visibleGroups, activeView.id, activeView.fields.cardOrder, groupByProperty, props.selectedCardIds])
|
||||
|
||||
const onDropToCard = useCallback(async (srcCard: Card, dstCard: Card) => {
|
||||
if (srcCard.id === dstCard.id) {
|
||||
if (srcCard.id === dstCard.id || !groupByProperty) {
|
||||
return
|
||||
}
|
||||
Utils.log(`onDropToCard: ${dstCard.title}`)
|
||||
@ -217,6 +212,11 @@ const Kanban = (props: Props) => {
|
||||
setShowCalculationsMenu(newShowOptions)
|
||||
}
|
||||
|
||||
if (!groupByProperty) {
|
||||
Utils.assertFailure('Board views must have groupByProperty set')
|
||||
return <div/>
|
||||
}
|
||||
|
||||
return (
|
||||
<ScrollingComponent
|
||||
className='Kanban'
|
||||
@ -326,25 +326,25 @@ const Kanban = (props: Props) => {
|
||||
{/* Hidden columns */}
|
||||
|
||||
{(hiddenGroups.length > 0 || hiddenCardsCount > 0) &&
|
||||
<div className='octo-board-column narrow'>
|
||||
{hiddenGroups.map((group) => (
|
||||
<KanbanHiddenColumnItem
|
||||
key={group.option.id}
|
||||
group={group}
|
||||
activeView={activeView}
|
||||
intl={props.intl}
|
||||
readonly={props.readonly}
|
||||
onDrop={(card: Card) => onDropToColumn(group.option, card)}
|
||||
/>
|
||||
))}
|
||||
{hiddenCardsCount > 0 &&
|
||||
<div className='ml-1'>
|
||||
<HiddenCardCount
|
||||
hiddenCardsCount={hiddenCardsCount}
|
||||
showHiddenCardNotification={props.showHiddenCardCountNotification}
|
||||
/>
|
||||
<div className='octo-board-column narrow'>
|
||||
{hiddenGroups.map((group) => (
|
||||
<KanbanHiddenColumnItem
|
||||
key={group.option.id}
|
||||
group={group}
|
||||
activeView={activeView}
|
||||
intl={props.intl}
|
||||
readonly={props.readonly}
|
||||
onDrop={(card: Card) => onDropToColumn(group.option, card)}
|
||||
/>
|
||||
))}
|
||||
{hiddenCardsCount > 0 &&
|
||||
<div className='ml-1'>
|
||||
<HiddenCardCount
|
||||
hiddenCardsCount={hiddenCardsCount}
|
||||
showHiddenCardNotification={props.showHiddenCardCountNotification}
|
||||
/>
|
||||
</div>}
|
||||
</div>}
|
||||
</div>}
|
||||
</div>
|
||||
</ScrollingComponent>
|
||||
)
|
||||
|
@ -85,7 +85,6 @@ export default function KanbanColumnHeader(props: Props): JSX.Element {
|
||||
const groupCalculation = props.activeView.fields.kanbanCalculations[props.group.option.id]
|
||||
const calculationValue = groupCalculation ? groupCalculation.calculation : defaultCalculation
|
||||
const calculationProperty = groupCalculation ? props.board.cardProperties.find((property) => property.id === groupCalculation.propertyId) || defaultProperty : defaultProperty
|
||||
|
||||
return (
|
||||
<div
|
||||
key={group.option.id || 'empty'}
|
||||
|
Loading…
Reference in New Issue
Block a user