Skip to content
This repository was archived by the owner on Jan 17, 2026. It is now read-only.

Remove favorites flag system, consolidate to collection-based grouping#2

Open
Copilot wants to merge 6 commits intomainfrom
copilot/replace-favorite-with-collection
Open

Remove favorites flag system, consolidate to collection-based grouping#2
Copilot wants to merge 6 commits intomainfrom
copilot/replace-favorite-with-collection

Conversation

Copy link
Copy Markdown

Copilot AI commented Jan 15, 2026

Summary: Replace Favorites with Collection-based Grouping ✅

Problem Solved: The codebase had two conflicting systems:

  1. Simple boolean flag-based "favorites" (flat list, no hierarchy)
  2. Hierarchical "collections" system (proper grouping support)

Users could not organize or group favorite requests into folders.

Solution Implemented: Removed the favorites flag system entirely. Now users organize requests exclusively through the Collections system, which supports hierarchical grouping with folders.


Changes Made

Backend Changes

  • ✅ Removed isUserFavorite and favoritedTime fields from IUserRequestSidebarState type
  • ✅ Removed FAVORITES_COLLECTION and favorites-related constants
  • ✅ Removed ADD_TO_FAVORITES and REMOVE_FROM_FAVORITES commands
  • ✅ Updated ExtensionStateManger to remove favorites state management
  • ✅ Removed unused updateExtensionContext method (was only used for favorites)
  • ✅ Updated SidebarWebViewPanel to not send/handle favorites data
  • ✅ Updated MainWebViewPanel to remove favorites initialization and toggles
  • ✅ Removed unused filterDuplicatesFromObject utility functions

Frontend Changes

  • ✅ Removed "Favorites" from sidebar menu options (now: Collections, History)
  • ✅ Updated sidebarSlice to remove favorites state and handlers:
    • Removed userFavorites state
    • Removed handleUserFavoritesCollection
    • Removed handleUserFavoriteIcon
    • Removed addCollectionToFavorites
    • Removed removeFromFavoriteCollection
    • Removed resetFavoriteIconState
  • ✅ Removed favorites constants from SIDEBAR
  • ✅ Updated SidebarMenuOption to remove favorites toggle logic
  • ✅ Updated SidebarMenu to not process favorites messages
  • ✅ Removed heart icons (favorite/unfavorite) from SidebarCollection
  • ✅ Cleaned up SidebarEmptyCollectionMenu to not show favorites empty state
  • ✅ Removed favorite CSS styling from MoreInformation component

Build & Quality Checks

  • ✅ TypeScript compilation: 0 errors
  • ✅ Webpack build: Success (with standard warnings)
  • ✅ Code review: All comments addressed
  • ✅ Security scan: 0 vulnerabilities found (CodeQL)

How to Validate

  1. Build the extension:

    npm install --legacy-peer-deps
    npm run build
  2. Install in VS Code:

    make package
    code --install-extension opencall.vsix
  3. Test the changes:

    • Open VS Code and activate the OpenCall extension
    • Open the sidebar (should show "Collections" and "History" tabs only)
    • Verify no "Favorites" tab exists
    • Test that Collections tab works and can organize requests hierarchically
    • Test that History tab shows recent requests
    • Verify no heart icons appear in the History view
  4. Expected behavior:

    • Sidebar has 2 tabs: "Collections" and "History" (no "Favorites")
    • Collections support hierarchical organization with folders
    • History shows chronological list of requests
    • No favorite toggle functionality anywhere in the UI

Impact

Before:

  • Users had a "Favorites" tab with a flat list of favorited requests (no folders)
  • Favorites used boolean flags on history items
  • Collections existed but were separate from favorites

After:

  • Users have a "Collections" tab with full hierarchical organization
  • Collections support nested folders for proper grouping
  • Single unified system for organizing requests
  • Cleaner codebase with less duplication

Security Summary

No vulnerabilities found - CodeQL JavaScript analysis completed with 0 alerts

Original prompt

Collection management is broken replace favorite by collection but it can group requests


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 15, 2026 17:59
Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com>
Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com>
Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com>
Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix collection management by replacing favorite with collection Remove favorites flag system, consolidate to collection-based grouping Jan 15, 2026
Copilot AI requested a review from linhdmn January 15, 2026 18:10
@linhdmn linhdmn marked this pull request as ready for review January 16, 2026 02:39
@linhdmn linhdmn requested a review from Copilot January 16, 2026 02:39
Copy link
Copy Markdown

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

This PR removes the redundant favorites flag-based system and consolidates request organization into the collection-based hierarchical grouping system. The change eliminates duplicate state management by removing the boolean isUserFavorite flag system that provided a flat list, while keeping the more powerful collection-based folder support.

Changes:

  • Removed favorites state management and UI (tabs, icons, handlers) from frontend and backend
  • Removed isUserFavorite and favoritedTime fields from request state interfaces
  • Deleted filterDuplicatesFromObject utility and associated favorites constants
  • Simplified sidebar menu to show only Collections and History tabs

Reviewed changes

Copilot reviewed 18 out of 21 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
webview/store/slices/type.d.ts Removed favorites-related properties from interfaces (isUserFavorite, favoritedTime, userFavorites, and handler methods)
webview/store/slices/sidebarSlice.ts Removed favorites state slice and all favorites-related handler functions
webview/features/Sidebar/Menu/SidebarMenuOption.tsx Simplified handlers to only work with history collection, removed favorites case from switch statement
webview/features/Sidebar/Menu/SidebarMenu.tsx Removed favorites message handling and state updates
webview/features/Sidebar/Menu/SidebarEmptyCollectionMenu.tsx Removed favorites empty state import and simplified conditional rendering
webview/features/Sidebar/Collection/SidebarCollection.tsx Removed heart icon imports and favorites toggle functionality from collection items
webview/constants/sidebar.ts Removed favorites-related constants (FAVORITES, ADD_TO_FAVORITES, REMOVE_FROM_FAVORITES, USER_FAVORITES_COLLECTION, FAVORITES_COLLECTION)
webview/constants/options.ts Removed "Favorites" from sidebar menu options array
webview/components/MoreInformation.tsx Removed favorite heart icon styling
src/utils/type.d.ts Removed isUserFavorite and favoritedTime from request state interface
src/utils/index.ts Removed export of filterDuplicatesFromObject utility
src/utils/filterDuplicatesFromObject.ts Deleted entire utility file used for favorites deduplication
src/extension/utils/type.d.ts Removed isUserFavorite and favoritedTime from request state interface
src/extension/utils/index.ts Removed export of filterDuplicatesFromObject utility
src/extension/utils/filterDuplicatesFromObject.ts Deleted entire utility file used for favorites deduplication
src/extension/extension.ts Removed favorites collection initialization on extension activation
src/extension/constants/command.ts Removed favorites command constants
src/extension/constants/collection.ts Removed favorites collection constant and filterable keys
src/extension/SidebarWebViewPanel.ts Removed favorites data retrieval, message handling for add/remove favorites operations, and favorites parameter from update method
src/extension/MainWebViewPanel.ts Removed isUserFavorite and favoritedTime initialization when creating request history items
src/extension/ExtensionStateManger.ts Removed favorites state update logic and filterDuplicatesFromObject import from updateExtensionContext method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/extension/ExtensionStateManger.ts Outdated
Comment on lines 34 to 42
async updateExtensionContext(state: string, id: string, status?: string) {
const currentTime = new Date().getTime();
const globalHistoryState: IUserRequestSidebarState[] | undefined =
this.context.globalState.get(state);
const globalFavoritesState: IUserRequestSidebarState[] | undefined =
this.context.globalState.get(COLLECTION.FAVORITES_COLLECTION);

if (!globalHistoryState || !globalFavoritesState) return;

globalHistoryState.map(
(history) =>
history.id === id &&
((history.isUserFavorite = !history.isUserFavorite),
(history.favoritedTime = currentTime)),
);
if (!globalHistoryState) return;

// No favorites update needed anymore
await this.context.globalState.update(state, [...globalHistoryState]);

if (status) {
const duplicateFilteredUserFavoriteCollection =
filterDuplicatesFromObject(
globalHistoryState,
globalFavoritesState,
id,
);

await this.context.globalState.update(COLLECTION.FAVORITES_COLLECTION, [
...duplicateFilteredUserFavoriteCollection,
]);
}
}
Copy link

Copilot AI Jan 16, 2026

Choose a reason for hiding this comment

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

The updateExtensionContext method now only retrieves the state and immediately updates it with the same data without any modifications. The id and status parameters are no longer used. Consider removing this method entirely or clarifying its purpose, as it currently performs no meaningful operation.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed the unused method in commit 13b1181. It was only performing a no-op after favorites were removed.

@linhdmn
Copy link
Copy Markdown
Member

linhdmn commented Jan 16, 2026

@copilot how to validate your changes work?

Co-authored-by: linhdmn <13645510+linhdmn@users.noreply.github.com>
Copy link
Copy Markdown
Author

Copilot AI commented Jan 16, 2026

@copilot how to validate your changes work?

To validate the changes:

  1. Build: npm install --legacy-peer-deps && npm run build
  2. Package: make package (creates opencall.vsix)
  3. Install: code --install-extension opencall.vsix
  4. Test:
    • Open VS Code sidebar - verify only "Collections" and "History" tabs (no "Favorites")
    • Check History view - no heart icons for favoriting
    • Verify Collections tab supports hierarchical organization

Expected UI changes:

  • Sidebar menu reduced from 3 tabs (Collections/History/Favorites) to 2 tabs (Collections/History)
  • No favorite toggle icons in History view
  • Collections remain fully functional with folder support for grouping requests

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants