bito-code-review[bot] commented on PR #40968:
URL: https://github.com/apache/superset/pull/40968#issuecomment-4678712478
<!-- Bito Reply -->
The flagged issue is correct. The current implementation of
`getRegisteredViewIds` uses a `Set` to store IDs, which preserves insertion
order but does not update the order when an existing ID is re-registered.
Consequently, `getActiveChatbot` (which selects the last element of the array)
fails to reflect the most recent registration if an existing chatbot is
re-registered.
To resolve this, you should ensure that re-registering an existing ID moves
it to the end of the registration sequence. You can achieve this by removing
the ID from the `Set` before adding it again in `registerView` (or by using an
array and `splice` to reorder).
**superset-frontend/src/core/views/index.ts**
```
const ids = locationIndex.get(location) ?? new Set();
if (ids.has(id)) {
ids.delete(id);
}
ids.add(id);
locationIndex.set(location, ids);
```
--
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]