VFB-242 - Fix Toolbar and Datasets selection issues#227
VFB-242 - Fix Toolbar and Datasets selection issues#227ddelpiano merged 5 commits intodevelopmentfrom
Conversation
…and checks to use these constants too. Fixes bug introduced by shifting navigation buttons once.
…Dropdown component
There was a problem hiding this comment.
Pull request overview
Refactors bottom navigation/tab selection across the Virtual Fly Brain frontend by replacing hardcoded numeric indices with named constants, while also adjusting query builder/query selection behavior to address toolbar/dataset selection issues.
Changes:
- Introduces named
bottomNav*constants and updates multiple components to use them instead of hardcoded indices. - Updates query builder row/tag filtering to handle
preview_results.rows, fixes React chip keys, and adjusts query clearing behavior. - Modifies query selection activation logic to ensure only one query in a group is active at a time.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| applications/virtual-fly-brain/frontend/src/utils/constants.js | Adds named bottom-nav index constants to centralize tab/index management. |
| applications/virtual-fly-brain/frontend/src/shared/subHeader/index.jsx | Uses named constant for “Clear All” handling in the subheader nav. |
| applications/virtual-fly-brain/frontend/src/shared/subHeader/SearchBuilder.jsx | Uses named query-tab constant; comments out query activation/fetching logic. |
| applications/virtual-fly-brain/frontend/src/shared/subHeader/QueriesSelection/QueriesSelectionDropdown.jsx | Updates selection handler to deactivate other queries in the same group. |
| applications/virtual-fly-brain/frontend/src/shared/header/index.jsx | Uses named query-tab constant; modifies “run query from history” activation/fetch logic. |
| applications/virtual-fly-brain/frontend/src/shared/bottomNav/index.jsx | Replaces hardcoded ids with constants for bottom nav items. |
| applications/virtual-fly-brain/frontend/src/components/queryBuilder/Query.jsx | Enhances row extraction/filtering, fixes chip keys, and changes clear-all dispatch behavior. |
| applications/virtual-fly-brain/frontend/src/components/configuration/VFBToolbar/vfbtoolbarMenuConfiguration.jsx | Replaces toolbar navigation indices with named constants. |
| applications/virtual-fly-brain/frontend/src/components/Layout.jsx | Replaces bottom-nav numeric checks with named constants across layout logic. |
Comments suppressed due to low confidence (1)
applications/virtual-fly-brain/frontend/src/components/queryBuilder/Query.jsx:41
termis always a string here (defaults to ""), soif (term != undefined)is always true and the expensive filter runs even when the search term is empty, doing unnecessary work on every render. Change this condition to only filter when the term is non-empty (e.g.term.length > 0).
const term = searchTerm ? searchTerm.toLowerCase() : "";
newQueries.forEach((query) => {
if (query.queries) {
Object.keys(query.queries).forEach((key) => {
if (query.queries[key]?.active) {
let rows = query.queries[key]?.rows || query.queries[key]?.preview_results?.rows || [];
if (term != undefined) {
rows = rows.filter(row => {
// Cache the string conversion for performance
const values = Object.values(row);
return values.some(v => v && v.toString().toLowerCase().includes(term));
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ee2f13e211
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
VFB-242 - Fix Toolbar and Datasets selection issues and refactors how navigation tab indices are managed throughout the frontend by replacing hardcoded numeric indices with named constants imported from a central
constantsfile. This change improves code readability, maintainability, and reduces the risk of errors when updating or reordering navigation items. Additionally, there are several bug fixes and improvements in the query builder and query selection components to ensure correct state updates and filtering behavior.Navigation Refactor and Consistency:
0,1,2, etc.) with named constants (such asbottomNavQuery,bottomNavClearAll, etc.) across all relevant components, includingLayout.jsx,VFBToolbarMenuConfiguration.jsx,header/index.jsx,bottomNav/index.jsx, andsubHeader/index.jsx. This centralizes tab management and improves code clarity. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]Query Builder Improvements and Bug Fixes:
rowsandpreview_results.rows, ensuring that queries without directrowsstill display results properly. Enhanced tag filtering and ensured correct memoization of filtered results. [1] [2] [3]tag.label) for each chip, preventing React key warnings.Query Selection and Activation Logic:
Minor Adjustments:
SearchBuilder.jsxrelated to query activation and fetching, likely as part of a refactor.