Skip to content

VFB-242 - Fix Toolbar and Datasets selection issues#227

Merged
ddelpiano merged 5 commits intodevelopmentfrom
feature/VFB-242
May 6, 2026
Merged

VFB-242 - Fix Toolbar and Datasets selection issues#227
ddelpiano merged 5 commits intodevelopmentfrom
feature/VFB-242

Conversation

@jrmartin
Copy link
Copy Markdown
Collaborator

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 constants file. 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:

  • Replaced all hardcoded navigation tab indices (e.g., 0, 1, 2, etc.) with named constants (such as bottomNavQuery, bottomNavClearAll, etc.) across all relevant components, including Layout.jsx, VFBToolbarMenuConfiguration.jsx, header/index.jsx, bottomNav/index.jsx, and subHeader/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:

  • Improved row extraction and filtering logic in the query builder to handle both rows and preview_results.rows, ensuring that queries without direct rows still display results properly. Enhanced tag filtering and ensured correct memoization of filtered results. [1] [2] [3]
  • Fixed an issue where clearing queries did not dispatch the update action, ensuring state is properly updated in Redux.
  • Corrected chip tag rendering by using a unique key (tag.label) for each chip, preventing React key warnings.

Query Selection and Activation Logic:

  • Updated query selection dropdown to activate only the selected query and deactivate others within the same group, ensuring only one query is active at a time. The handler now uses the selected label to determine which query to activate. [1] [2]

Minor Adjustments:

  • Adjusted the default value for the search term in query filtering to an empty string for consistency.
  • Commented out unused or redundant code in SearchBuilder.jsx related to query activation and fetching, likely as part of a refactor.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • term is always a string here (defaults to ""), so if (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.

Comment thread applications/virtual-fly-brain/frontend/src/components/queryBuilder/Query.jsx Outdated
Comment thread applications/virtual-fly-brain/frontend/src/shared/header/index.jsx
Comment thread applications/virtual-fly-brain/frontend/src/shared/header/index.jsx Outdated
Comment thread applications/virtual-fly-brain/frontend/src/shared/subHeader/SearchBuilder.jsx Outdated
Comment thread applications/virtual-fly-brain/frontend/src/shared/subHeader/index.jsx Outdated
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread applications/virtual-fly-brain/frontend/src/shared/header/index.jsx
@jrmartin jrmartin requested a review from ddelpiano April 30, 2026 16:03
@ddelpiano ddelpiano merged commit c651534 into development May 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants