Skip to content

fix(wework): improve plugin marketplace search performance - #2641

Merged
qdaxb merged 3 commits into
wecode-ai:mainfrom
luckjun529-lang:fix/plugin-marketplace-search-performance
Aug 13, 2026
Merged

qdaxb merged 3 commits into
wecode-ai:mainfrom
luckjun529-lang:fix/plugin-marketplace-search-performance

Conversation

@luckjun529-lang

@luckjun529-lang luckjun529-lang commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • keep marketplace input updates local and debounce catalog filtering by 200 ms
  • defer filtering until IME composition finishes
  • render large search result sets in batches of 40
  • cover typing stability, IME input, and batched result expansion

Root cause

The controlled search input updated the full plugin workspace on every keystroke. Large catalogs repeatedly ran filtering, grouping, and row rendering on the input path, which made typing visibly lag.

Impact

Marketplace search remains responsive while preserving the existing filters and result behavior. Large result sets render progressively instead of blocking the first paint.

Validation

  • focused Vitest: 92 tests passed
  • ESLint and Prettier passed
  • Bugbot: no actionable findings
  • Security Review: no actionable findings
  • Wework desktop plugin E2E passed
  • repository pre-push quality checks passed

Summary by CodeRabbit

  • New Features

    • Added a marketplace search field with debounced updates, clear controls, Escape-key clearing, and improved composition support.
    • Search results now appear in manageable batches, with an option to reveal more results.
    • Added accessible search and clear controls, including support for maintaining focus when clearing a query.
  • Bug Fixes

    • Improved search behavior while entering text through IME composition.
    • Clearing a search now updates results immediately.
    • Large result sets are rendered incrementally for a smoother browsing experience.

@coderabbitai

coderabbitai Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 28ee5398-3c78-4605-91f1-097805c94054

📥 Commits

Reviewing files that changed from the base of the PR and between 9f48d22 and ee294bd.

📒 Files selected for processing (3)
  • wework/src/components/plugins/MarketplaceSearchInput.tsx
  • wework/src/components/plugins/PluginsWorkspace.test.tsx
  • wework/src/components/plugins/PluginsWorkspace.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • wework/src/components/plugins/PluginsWorkspace.test.tsx
  • wework/src/components/plugins/MarketplaceSearchInput.tsx
  • wework/src/components/plugins/PluginsWorkspace.tsx

📝 Walkthrough

Walkthrough

The PR adds MarketplaceSearchInput with debounced queries, IME handling, and imperative clearing. PluginsWorkspace uses it for marketplace search and renders matching results in batches of 40. Tests cover deferred filtering, composition, and large catalogs.

Changes

Marketplace search experience

Layer / File(s) Summary
Search input behavior
wework/src/components/plugins/MarketplaceSearchInput.tsx
Adds the ref-forwarding MarketplaceSearchInput component and MarketplaceSearchInputHandle. Query changes use a 200 ms debounce, while cleared queries commit immediately. Composition, Escape, clear-button, focus, and icon behavior are handled.
Workspace integration and result batching
wework/src/components/plugins/PluginsWorkspace.tsx, wework/src/components/plugins/PluginsWorkspace.test.tsx
Replaces the inline search controls, tracks the normalized query and visible result limit, clears through the input handle, and reveals marketplace search results in batches of 40. Tests cover deferred filtering, IME composition, and large catalogs.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Mergeability Score: ⚪ Minimal · up to ee294

The change keeps marketplace search responsive through local input updates, deferred filtering, and batched result rendering, with no actionable merge-blocking risk remaining after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant MarketplaceSearchInput
  participant PluginsWorkspace
  User->>MarketplaceSearchInput: Enter marketplace query
  MarketplaceSearchInput->>PluginsWorkspace: Send onQueryChange after debounce
  PluginsWorkspace->>PluginsWorkspace: Filter and limit results to 40
  PluginsWorkspace-->>User: Render marketplace results
  User->>PluginsWorkspace: Reveal more results
  PluginsWorkspace->>PluginsWorkspace: Increase visible limit by 40
  PluginsWorkspace-->>User: Render the next result batch
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: improving plugin marketplace search performance.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@luckjun529-lang
luckjun529-lang marked this pull request as ready for review August 12, 2026 15:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@wework/src/components/plugins/PluginsWorkspace.tsx`:
- Around line 1523-1527: Reset searchResultWindow to the default query and
MARKETPLACE_SEARCH_RESULT_BATCH_SIZE whenever an accepted search query changes,
before storing the new query, so returning to a prior term cannot reuse its
expanded limit. Update the search-query state flow near visibleSearchResultLimit
and add a regression test covering expand → change query → restore query,
asserting the restored query starts at the batch size.
- Line 1282: Split the oversized marketplace functionality into focused modules:
in wework/src/components/plugins/PluginsWorkspace.tsx:1282-1282, extract
marketplace search state, batching logic, and related callbacks from
PluginsWorkspace while preserving behavior; in
wework/src/components/plugins/PluginsWorkspace.test.tsx:1312-1359, move the
marketplace search interaction tests into a companion focused test module.
Ensure both original files comply with the 1000-line limit.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 44d11d40-3ab8-49c1-b1c9-595327f759be

📥 Commits

Reviewing files that changed from the base of the PR and between 69d403a and 257588b.

📒 Files selected for processing (3)
  • wework/src/components/plugins/MarketplaceSearchInput.tsx
  • wework/src/components/plugins/PluginsWorkspace.test.tsx
  • wework/src/components/plugins/PluginsWorkspace.tsx

const { t } = useTranslation('common')
const appearanceMode = useOptionalAppearance()?.resolvedMode ?? 'light'
const [query, setQuery] = useState('')
const [searchResultWindow, setSearchResultWindow] = useState({ query: '', limit: 0 })

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Split the changed marketplace modules.

Both changed files exceed the required 1000-line limit. Extract cohesive marketplace search and batching logic, then move its focused tests into companion test modules.

  • wework/src/components/plugins/PluginsWorkspace.tsx#L1282-L1282: extract marketplace search state, batching, and callbacks from PluginsWorkspace.
  • wework/src/components/plugins/PluginsWorkspace.test.tsx#L1312-L1359: move marketplace search interaction coverage into a focused companion test file.

As per coding guidelines, “split files over 1000 lines.”

📍 Affects 2 files
  • wework/src/components/plugins/PluginsWorkspace.tsx#L1282-L1282 (this comment)
  • wework/src/components/plugins/PluginsWorkspace.test.tsx#L1312-L1359
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/plugins/PluginsWorkspace.tsx` at line 1282, Split the
oversized marketplace functionality into focused modules: in
wework/src/components/plugins/PluginsWorkspace.tsx:1282-1282, extract
marketplace search state, batching logic, and related callbacks from
PluginsWorkspace while preserving behavior; in
wework/src/components/plugins/PluginsWorkspace.test.tsx:1312-1359, move the
marketplace search interaction tests into a companion focused test module.
Ensure both original files comply with the 1000-line limit.

Source: Coding guidelines

Comment on lines +1523 to +1527
const isMarketplaceSearchUpdating = Boolean(normalizedQuery) && isMarketplaceRefreshing
const visibleSearchResultLimit =
searchResultWindow.query === normalizedQuery
? searchResultWindow.limit
: MARKETPLACE_SEARCH_RESULT_BATCH_SIZE

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚀 Performance & Scalability | 🟠 Major | ⚡ Quick win

Reset the batch window for each accepted search query.

When a user expands a query, searches for another term, then returns to the first term, visibleSearchResultLimit restores the old expanded limit. A large catalog can then render all previously revealed rows at once and bypass the 40-result bound.

Reset searchResultWindow before setting the accepted query. Add a regression test for expand → change query → restore query.

Proposed fix
-                  onQueryChange={setQuery}
+                  onQueryChange={nextQuery => {
+                    setSearchResultWindow({ query: '', limit: 0 })
+                    setQuery(nextQuery)
+                  }}

Also applies to: 4731-4738

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@wework/src/components/plugins/PluginsWorkspace.tsx` around lines 1523 - 1527,
Reset searchResultWindow to the default query and
MARKETPLACE_SEARCH_RESULT_BATCH_SIZE whenever an accepted search query changes,
before storing the new query, so returning to a prior term cannot reuse its
expanded limit. Update the search-query state flow near visibleSearchResultLimit
and add a regression test covering expand → change query → restore query,
asserting the restored query starts at the batch size.

@qdaxb
qdaxb added this pull request to the merge queue Aug 13, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 13, 2026
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@qdaxb
qdaxb enabled auto-merge August 13, 2026 05:58
@qdaxb
qdaxb added this pull request to the merge queue Aug 13, 2026
Merged via the queue into wecode-ai:main with commit 127ee28 Aug 13, 2026
38 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.

2 participants