-
Notifications
You must be signed in to change notification settings - Fork 16.8k
fix(charts): Table chart shows an error on row limit #37218
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
Changes from all commits
3dc4594
1c5418e
d7f86a7
a419754
84c1224
c95eec0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| /** | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import type { ValidatorFunction } from '../validator'; | ||
|
|
||
| /** | ||
| * Wraps a validator function to prepend a label to its error message. | ||
| * | ||
| * @param validator - The validator function to wrap | ||
| * @param label - The label to prepend to error messages | ||
| * @returns A new validator function that includes the label in error messages | ||
| * | ||
| * @example | ||
| * validators: [ | ||
| * withLabel(validateInteger, t('Row limit')), | ||
| * ] | ||
| * // Returns: "Row limit is expected to be an integer" | ||
| */ | ||
| export default function withLabel<V = unknown, S = unknown>( | ||
| validator: ValidatorFunction<V, S>, | ||
| label: string, | ||
| ): ValidatorFunction<V, S> { | ||
| return (value: V, state?: S): string | false => { | ||
| const error = validator(value, state); | ||
| return error ? `${label} ${error}` : false; | ||
| }; | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| /** | ||
| * Type definition for a validator function. | ||
| * Returns an error message string if validation fails, or false if validation passes. | ||
| */ | ||
| export type ValidatorFunction<V = unknown, S = unknown> = ( | ||
| value: V, | ||
| state?: S, | ||
| ) => string | false; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -122,7 +122,8 @@ export function applyMapStateToPropsToControl<T = ControlType>( | |
| } | ||
| } | ||
| // If no current value, set it as default | ||
| if (state.default && value === undefined) { | ||
| // Use loose equality to catch both null and undefined | ||
| if (state.default != null && value == null) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks much cleaner, great work! |
||
| value = state.default; | ||
| } | ||
| // If a choice control went from multi=false to true, wrap value in array | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Suggestion: Reinventing and duplicating array-wrapping logic: the code manually checks and wraps values for Severity Level: Major
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.