bito-code-review[bot] commented on code in PR #39535:
URL: https://github.com/apache/superset/pull/39535#discussion_r3329655606


##########
superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx:
##########
@@ -84,7 +90,7 @@ export const ModalTrigger = forwardRef(
       setShowModal(true);
     };
 
-    if (ref) {
+    if (ref && typeof ref !== 'function') {
       ref.current = { close, open, showModal }; // eslint-disable-line
     }

Review Comment:
   <!-- Bito Reply -->
   The thread in question has been resolved with the fix applied in commit 
49dbed21. The callback-ref branch was added to handle both object refs and 
callback refs correctly. Bito's repeated messages are a known artifact of the 
/resolve command not being supported on inline comments. No further action is 
needed.
   
   
**superset-frontend/packages/superset-ui-core/src/components/ModalTrigger/index.tsx**
   ```
   if (ref) {
         if (typeof ref === 'function') {
           ref({ close, open, showModal });
         } else {
           ref.current = { close, open, showModal }; // eslint-disable-line
         }
       }
   ```



##########
superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts:
##########
@@ -55,7 +55,12 @@ class LRUCache<T> {
       throw new TypeError('The LRUCache key must be string.');
     }
     if (this.cache.size >= this.capacity) {
-      this.cache.delete(this.cache.keys().next().value);
+      // Forward-compat: TS 6.0 types IteratorResult.value as `string | 
undefined`
+      // when not explicitly checked; guard before passing to Map#delete.
+      const oldestKey = this.cache.keys().next().value;
+      if (oldestKey !== undefined) {
+        this.cache.delete(oldestKey);
+      }

Review Comment:
   <!-- Bito Reply -->
   The `if (oldestKey !== undefined)` guard is intentionally kept for 
TypeScript 6.0 forward-compatibility. The discussion in the thread confirms 
that the guard ensures type safety under strict null checks, even though it may 
appear redundant at runtime. The reviewer has declined the suggestion to remove 
the guard, as it is necessary to comply with TypeScript's tightened iterator 
protocol. The thread is closed, and the guard remains in the code for type 
correctness.
   
   **superset-frontend/packages/superset-ui-core/src/utils/lruCache.ts**
   ```
   this.cache.delete(this.cache.keys().next().value);
   ```



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to