Skip to content

fix(studio): show failures and empty searches in the global asset view - #4903

Open
kohjunhao wants to merge 1 commit into
heygen-com:mainfrom
kohjunhao:fix/global-assets-view-states
Open

kohjunhao wants to merge 1 commit into
heygen-com:mainfrom
kohjunhao:fix/global-assets-view-states

Conversation

@kohjunhao

Copy link
Copy Markdown

What

The global asset view now tells four situations apart: loading, a failed request, a successful empty cache, and a search that matches none of the cached assets. A failed request offers a "Try again" button.

Why

The view showed "No assets in the global cache yet" for an empty cache, a failed request and a search with no matches. A non-OK response was converted to { assets: [] }, a rejected request to [], and any empty filtered list fell through to the empty-cache message, so users were told their cache was empty when the data was unavailable or only filtered out.

Related work

Fixes #4385 (approach posted on the issue first)

How

  • One state value with three cases (loading, failed, loaded) replaces the nullable records array.
  • A non-OK response throws into the existing catch, so both failure kinds land in failed.
  • "Try again" sets loading and re-runs the fetch effect. Nothing retries on its own.
  • "No global assets match" shows only when the request succeeded with records and the search filtered all of them out. Clearing the search restores the rows from memory without a new request.
  • The successful-response handling and the existing empty-cache guidance are unchanged.

Test plan

  • Unit tests added/updated
  • Manual testing performed
  • Documentation updated (if applicable)
  • Comments follow CONTRIBUTING.md "Comments"

GlobalAssetsView.test.tsx uses controlled fetch responses. Five of its six cases fail on main, showing the empty-cache text for an error status, a rejected request and an unmatched search, and finding no way to retry.

bun run --cwd packages/studio test src/components/sidebar/GlobalAssetsView.test.tsx
bun run --cwd packages/studio test        (630 files, 6,934 tests pass on Node 22)
bun run --cwd packages/studio typecheck
bun run lint
bun run format:check
bunx fallow audit --base origin/main --fail-on-issues

The global asset view showed "No assets in the global cache yet" for an
empty cache, a failed request and a search with no matches: a non-OK
response became { assets: [] }, a rejected request became [], and any
empty filtered list fell through to the empty-cache message.

Track loading, failed and loaded separately. A failed request shows a
failure message with a Try again button and no automatic retry. A
search that hides every record says nothing matches, and clearing it
restores the rows from memory without a second request. A successful
empty response keeps the existing guidance.

Fixes heygen-com#4385

This branch has not been deployed

No deployments
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.

Global asset view reports failures and unmatched searches as an empty cache

1 participant