Skip to content

Commit

Permalink
fix: invalid count issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sreehari2003 committed Apr 17, 2024
1 parent a1c01bd commit 048ea0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/nc-gui/components/smartsheet/toolbar/FieldsMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,7 @@ const {
const hiddenFields = ref<string[]>([])
const isLocalMode = computed(
() => isPublic || !isUIAllowed('viewFieldEdit') || !isUIAllowed('viewFieldEdit') || isSharedBase.value,
)
const isLocalMode = computed(() => isPublic || !isUIAllowed('viewFieldEdit') || isSharedBase.value)
const shouldShowField = (id: string) => {
if (isLocalMode.value && hiddenFields.value.includes(id)) return false
Expand Down Expand Up @@ -92,7 +90,9 @@ watch(
const numberOfHiddenFields = computed(() => {
if (isLocalMode.value) {
return filteredFieldList.value?.filter((field) => !hiddenFields.value.includes(field.id) && !field.show)?.length
// slice is added to remove the first element ie column with name title as default value , without slice the count will always be one more than the exact count
return filteredFieldList.value?.slice(1).filter((field) => !hiddenFields.value.includes(field.id) && field.show === false)
?.length
} else {
return filteredFieldList.value?.filter((field) => !field.show)?.length
}
Expand Down
2 changes: 1 addition & 1 deletion packages/nc-gui/composables/useViewColumns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const [useProvideViewColumns, useViewColumns] = useInjectionState(
if (isLocalMode.value) {
fields.value = fields.value?.map((field: Field) => ({
...field,
show: false,
show: !!field.isViewEssentialField,
}))
reloadData?.()
return
Expand Down

0 comments on commit 048ea0c

Please sign in to comment.