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(paths): gracefully handle nulls for local cleaning filters #26085

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ import { PathCleanFilterAddItemButton } from './PathCleanFilterAddItemButton'
import { PathCleanFilterItem } from './PathCleanFilterItem'

export interface PathCleanFiltersProps {
filters?: PathCleaningFilter[]
filters?: PathCleaningFilter[] | null
setFilters: (filters: PathCleaningFilter[]) => void
}

export function PathCleanFilters({ filters = [], setFilters: _setFilters }: PathCleanFiltersProps): JSX.Element {
export function PathCleanFilters({ filters: _filters, setFilters: _setFilters }: PathCleanFiltersProps): JSX.Element {
const filters = _filters != null ? _filters : []
const [localFilters, setLocalFilters] = useState(filters)

const updateFilters = (filters: PathCleaningFilter[]): void => {
Expand Down
30 changes: 22 additions & 8 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -7806,10 +7806,17 @@
"type": "array"
},
"localPathCleaningFilters": {
"items": {
"$ref": "#/definitions/PathCleaningFilter"
},
"type": "array"
"anyOf": [
{
"items": {
"$ref": "#/definitions/PathCleaningFilter"
},
"type": "array"
},
{
"type": "null"
}
]
},
"maxEdgeWeight": {
"type": "integer"
Expand Down Expand Up @@ -7880,10 +7887,17 @@
"type": "array"
},
"local_path_cleaning_filters": {
"items": {
"$ref": "#/definitions/PathCleaningFilter"
},
"type": "array"
"anyOf": [
{
"items": {
"$ref": "#/definitions/PathCleaningFilter"
},
"type": "array"
},
{
"type": "null"
}
]
},
"max_edge_weight": {
"type": "integer"
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/queries/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,7 +1100,7 @@ export type PathsFilter = {
/** @default 5 */
stepLimit?: integer
pathReplacements?: PathsFilterLegacy['path_replacements']
localPathCleaningFilters?: PathsFilterLegacy['local_path_cleaning_filters']
localPathCleaningFilters?: PathsFilterLegacy['local_path_cleaning_filters'] | null
minEdgeWeight?: PathsFilterLegacy['min_edge_weight']
maxEdgeWeight?: PathsFilterLegacy['max_edge_weight']

Expand Down
2 changes: 1 addition & 1 deletion frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2356,7 +2356,7 @@ export interface PathsFilterType extends FilterType {
/** @asType integer */
step_limit?: number // Paths Step Limit
path_replacements?: boolean
local_path_cleaning_filters?: PathCleaningFilter[]
local_path_cleaning_filters?: PathCleaningFilter[] | null
/** @asType integer */
edge_limit?: number | undefined // Paths edge limit
/** @asType integer */
Expand Down
Loading