Copilot commented on code in PR #3286: URL: https://github.com/apache/apisix-dashboard/pull/3286#discussion_r2872353442
########## e2e/tests/routes.vars-admin-api.spec.ts: ########## @@ -0,0 +1,65 @@ +/** + * 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 { routesPom } from '@e2e/pom/routes' +import { e2eReq } from '@e2e/utils/req' +import { test } from '@e2e/utils/test' +import { expect } from '@playwright/test' + +import { deleteAllRoutes,putRouteReq } from '@/apis/routes' + Review Comment: This new e2e spec’s formatting diverges from the established style in the existing Playwright specs (e.g. spacing in object literals like `{ name: routeId }`, spaces after commas in imports/arrays, and consistent indentation). Please run the repo’s lint/auto-fix (`pnpm lint:fix`) or align the formatting with nearby specs like `e2e/tests/routes.list.spec.ts` to keep tests consistent and reduce diff noise. ########## src/components/form/TagInput.tsx: ########## @@ -44,9 +44,16 @@ export const FormItemTagsInput = <T extends FieldValues, R>( field: { value, onChange: fOnChange, ...restField }, fieldState, } = useController<T>(controllerProps); + + // Defensive: ensure value is always an array of strings to prevent + // "a.trim is not a function" errors when non-string values are passed + const safeValue = Array.isArray(value) + ? value.filter((item: unknown): item is string => typeof item === 'string') + : []; + return ( <TagsInput - value={from ? value.map(from) : value} + value={from ? safeValue.map(from) : safeValue} Review Comment: `safeValue` is derived by filtering `value` to strings before applying `from`, which breaks all current usages that rely on `from/to` to display non-string form values (e.g. numeric HTTP status arrays passed with `from={String}` / `to={Number}` will render as an empty tag list). Instead, build the `TagsInput` `value` from the original array: if `from` is provided, map the raw array through `from` and then ensure the mapped result is an array of strings; if `from` is not provided, only then filter/coerce the raw array to strings. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
