pierrejeambrun commented on code in PR #75229:
URL: https://github.com/apache/airflow/pull/75229#discussion_r4347829773
##########
airflow-core/tests/unit/api_fastapi/core_api/routes/public/test_plugins.py:
##########
@@ -196,6 +197,71 @@ def test_applies_to_rejects_non_list_values(self):
applies_to={"state": "failed"},
)
+ def test_ui_actions_schema_stays_discriminated_on_action_type(self):
+ """The UI and the generated ctl client both dispatch on
``action_type``.
+
+ Losing the discriminator in a refactor would still serialize, so
nothing else fails.
+ """
+ import yaml
Review Comment:
Small one: could these imports move to the top of the file?
##########
airflow-core/src/airflow/ui/rules/table-renderers.js:
##########
@@ -0,0 +1,56 @@
+/*!
+ * 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 { coreRules } from "./core.js";
+import { ERROR } from "./levels.js";
+
+// `no-restricted-syntax` is a single rule, so a scoped block replaces the
global list rather
+// than adding to it. Spread the core restrictions back in, or `*Columns.tsx`
would quietly
+// stop being checked for `React.FC` and the rest.
+const [, ...coreRestrictions] = coreRules.rules["no-restricted-syntax"];
+
+/**
+ * Table renderers must be module-level components.
+ *
+ * `flexRender` treats a `cell`/`card`/`header` function as a component
*type*. A factory such
+ * as `createColumns` runs in the render body, so an inline arrow is a new
function -- and so a
+ * new type -- on every render, and React unmounts and remounts the cell
instead of updating
+ * it. That closes anything the cell was holding open, a plugin's popover
included.
+ *
+ * `react/no-unstable-nested-components` cannot see this: it looks for
components declared
+ * inside a *component* in JSX position, and a column factory is neither.
+ *
+ * Scoped to `*Columns.tsx`, which is the convention for a module-level column
definition and
+ * the only shape that complies today. Tables that still build their columns
inline (DagRuns,
+ * TaskInstances and others) would need their existing columns lifted first.
+ */
+export const tableRendererRules = /** @type {const} @satisfies
{FlatConfig.Config} */ ({
+ files: ["src/**/*Columns.tsx"],
Review Comment:
I think this lint rule would be better as its own PR, it's unrelated to the
feature and DagRuns / TaskInstances don't comply yet. Could we drop it from
this one?
--
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]