Copilot commented on code in PR #55356:
URL: https://github.com/apache/airflow/pull/55356#discussion_r2328840532


##########
providers/edge3/src/airflow/providers/edge3/plugins/www/package.json:
##########
@@ -33,11 +33,14 @@
     "@emotion/react": "^11.14.0",
     "@tanstack/react-query": "^5.75.1",
     "axios": "^1.11.0",
+    "i": "^0.3.7",
     "next-themes": "^0.3.0",
+    "npm": "^11.6.0",

Review Comment:
   The packages "i" and "npm" appear to be accidentally added dependencies. The 
"i" package is likely a typo from running `npm i` and "npm" shouldn't be listed 
as a runtime dependency. These should be removed.
   ```suggestion
       "next-themes": "^0.3.0",
   ```



##########
providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/ui/ScrollToAnchor.tsx:
##########
@@ -0,0 +1,39 @@
+/*!
+ * 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.
+ */
+interface ScrollToAnchorProps {
+  inline?: ScrollLogicalPosition;
+  block?: ScrollLogicalPosition;
+}
+
+export const ScrollToAnchor = ({ block = "start", inline = "nearest" }: 
ScrollToAnchorProps): null => {
+  const hash = window.location.hash;
+  if (hash) {
+    const element = document.getElementById(hash.slice(1));
+
+    if (element) {
+      element.scrollIntoView({
+        behavior: "auto",
+        block: block,
+        inline: inline,
+      });
+    }
+  }

Review Comment:
   This component runs scroll logic on every render. Consider using useEffect 
to run this logic only on mount or when the hash changes to avoid potential 
performance issues and unexpected scrolling behavior.
   ```suggestion
   import React, { useEffect, useState } from "react";
   
   export const ScrollToAnchor = ({ block = "start", inline = "nearest" }: 
ScrollToAnchorProps): null => {
     const [hash, setHash] = useState(() => window.location.hash);
   
     useEffect(() => {
       const onHashChange = () => setHash(window.location.hash);
       window.addEventListener("hashchange", onHashChange);
       return () => window.removeEventListener("hashchange", onHashChange);
     }, []);
   
     useEffect(() => {
       if (hash) {
         const element = document.getElementById(hash.slice(1));
         if (element) {
           element.scrollIntoView({
             behavior: "auto",
             block: block,
             inline: inline,
           });
         }
       }
     }, [hash, block, inline]);
   ```



##########
providers/edge3/src/airflow/providers/edge3/plugins/www/package.json:
##########
@@ -33,11 +33,14 @@
     "@emotion/react": "^11.14.0",
     "@tanstack/react-query": "^5.75.1",
     "axios": "^1.11.0",
+    "i": "^0.3.7",
     "next-themes": "^0.3.0",
+    "npm": "^11.6.0",

Review Comment:
   The packages "i" and "npm" appear to be accidentally added dependencies. The 
"i" package is likely a typo from running `npm i` and "npm" shouldn't be listed 
as a runtime dependency. These should be removed.
   ```suggestion
       "next-themes": "^0.3.0",
   ```



-- 
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]

Reply via email to