jscheffl commented on code in PR #61318:
URL: https://github.com/apache/airflow/pull/61318#discussion_r2789979511
##########
providers/edge3/src/airflow/providers/edge3/plugins/www/src/layouts/NavTabs.tsx:
##########
@@ -33,46 +33,57 @@ export const NavTabs = ({ tabs }: Props) => {
const containerRef = useRef<HTMLDivElement>(null);
const containerWidth = useContainerWidth(containerRef);
- const { data } = useQuery<{version: string, git_version: string | null}>({
+ const { data } = useQuery<{ version: string; git_version: string | null }>({
queryFn: async () => {
const res = await axios.get("/api/v2/version");
return res.data;
},
queryKey: ["appVersion"],
});
- let legacyRouterNavigation: boolean | undefined = undefined;
+ let legacyRouterNavigation: boolean | undefined;
if (data) {
- const airflowCoreVersion = data.version;
- if (lte(airflowCoreVersion, "3.1.6")) {
- legacyRouterNavigation = true;
- } else {
- legacyRouterNavigation = false;
+ // Normalize Airflow version using semver.coerce to handle pre-release
suffixes
+ // coerce() converts "3.1.7rc1" to "3.1.7" for proper version comparison
+ const coercedVersion = coerce(data.version);
+ const airflowCoreVersion = coercedVersion?.version ?? null;
+
+ if (airflowCoreVersion) {
+ // Legacy navigation for versions <= 3.1.6
+ legacyRouterNavigation = lte(airflowCoreVersion, "3.1.6");
}
}
return (
<Flex alignItems="center" borderBottomWidth={1} mb={2} ref={containerRef}>
- {legacyRouterNavigation !== undefined ? tabs.map(({ icon, label, value
}) => (
Review Comment:
I do not understand why this code block - which obviously has no changes(?)
is re-formatted. Can you revert this? So that changes are only up to line 54?
##########
providers/edge3/src/airflow/providers/edge3/plugins/www/src/layouts/NavTabs.test.ts:
##########
Review Comment:
Thanks for adding the test. Actually what you test here is the version
library and not the code/widget.
Can you either remove the test (and we assume the library is tested
upstream) or extract the version check in NavTabs.tsx into a library/function
and then use the test to test the function for the cases?
--
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]