Skip to content

Commit 2730a05

Browse files
fix(projects): "fields" selector uses same default display list as my projects route DEV-292 (#5801)
### 📣 Summary Fixes issue where the "fields" selector would show "Countries" checked but the columns don't display it. Now the "fields" selector leaves "Countries" unchecked by default (to match the columns). ### 👀 Preview steps 1. ℹ️ have an account and multiple projects 2. navigate to the homepage (my projects) 3. reset the "fields" selector and refresh 4. 🟢 [on main] notice that the "countries" column is not present 5. click on "fields" selector 6. 🔴 [on main] notice that "countries" is checked 7. 🟢 [on PR] notice "countries" is not checked --------- Co-authored-by: Leszek Pietrzak <[email protected]> Co-authored-by: Leszek <[email protected]>
1 parent 24bb21d commit 2730a05

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

jsapp/js/projects/projectViews/projectsFieldsSelector.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import KoboModalContent from '#/components/modals/koboModalContent'
88
import KoboModalFooter from '#/components/modals/koboModalFooter'
99
import KoboModalHeader from '#/components/modals/koboModalHeader'
1010
import type { ProjectFieldName } from './constants'
11-
import { DEFAULT_VISIBLE_FIELDS, PROJECT_FIELDS } from './constants'
11+
import { PROJECT_FIELDS } from './constants'
1212
import styles from './projectsFieldsSelector.module.scss'
1313

1414
interface ProjectsFieldsSelectorProps {
15+
defaultVisibleFields: ProjectFieldName[]
1516
/** Selected fields. If the settings don't exist yet, we accept undefined. */
1617
selectedFields: ProjectFieldName[] | undefined
1718
/**
@@ -28,7 +29,7 @@ export default function ProjectsFieldsSelector(props: ProjectsFieldsSelectorProp
2829
const getInitialSelectedFields = () => {
2930
let outcome: ProjectFieldName[] = []
3031
if (!props.selectedFields || props.selectedFields.length === 0) {
31-
outcome = DEFAULT_VISIBLE_FIELDS
32+
outcome = props.defaultVisibleFields
3233
} else {
3334
outcome = Array.from(props.selectedFields)
3435
}

jsapp/js/projects/universalProjectsRoute.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ function UniversalProjectsRoute(props: UniversalProjectsRouteProps) {
136136

137137
<ProjectsFieldsSelector
138138
onFieldsChange={customView.setFields.bind(customView)}
139+
defaultVisibleFields={props.defaultVisibleFields}
139140
selectedFields={toJS(customView.fields)}
140141
excludedFields={props.defaultExcludedFields}
141142
/>

0 commit comments

Comments
 (0)