rusackas commented on code in PR #40747:
URL: https://github.com/apache/superset/pull/40747#discussion_r3358074653
##########
superset-frontend/src/middleware/asyncEvent.ts:
##########
@@ -63,17 +63,17 @@ let config: AppConfig;
let transport: string;
let pollingDelayMs: number;
let pollingTimeoutId: number;
-let listenersByJobId: Record<string, ListenerFn>;
-let retriesByJobId: Record<string, number>;
+let listenersByJobId: Map<string, ListenerFn>;
+let retriesByJobId: Map<string, number>;
let lastReceivedEventId: string | null | undefined;
-const addListener = (id: string, fn: any) => {
- listenersByJobId[id] = fn;
+const addListener = (id: string, fn: ListenerFn) => {
+ listenersByJobId.set(id, fn);
};
Review Comment:
Good call - added a regression test (`test.each` over `__proto__`,
`constructor`, `prototype`, `hasOwnProperty`) in `asyncEvent.test.ts` that
asserts listeners keyed by these reserved job_ids resolve correctly through the
Map-based registries, guarding against any regression back to prototype-bearing
lookups or pollution.
--
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]