Skip to content

Fix search progress UI stuck after jobs complete - #200

Closed
Alien10140 wants to merge 2 commits into
jez500:mainfrom
Alien10140:fix/search-ui-progress-sync
Closed

Fix search progress UI stuck after jobs complete#200
Alien10140 wants to merge 2 commits into
jez500:mainfrom
Alien10140:fix/search-ui-progress-sync

Conversation

@Alien10140

@Alien10140 Alien10140 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Sync search progress from the service cache when reopening an in-progress or completed search
  • Stop Livewire polling once the search is complete
  • Cast $isComplete so the search-log completion state renders correctly

Why

Revisiting a finished search skipped refreshProgress() because isComplete was already set, so the UI kept showing only the local “Preparing to search” line even though the job had finished.

Test plan

  • Manually: start a product search, leave the page, return after completion — log and results should appear without a stuck spinner
  • Manually: while a search is running, confirm progress still polls about every 2s
  • CI green

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Improved search progress synchronization for both completed and in-progress searches.
    • Prevented unnecessary progress refresh behavior once a search is complete.
    • Updated progress log handling to reflect current service state without redundant entries.
  • Performance
    • Reduced polling: progress updates now refresh every 2 seconds only while the search is incomplete and visible.

Reopening a completed search skipped loading the cached log because
refreshProgress() bailed when isComplete was already set. Sync from the
service cache on revisit, cast complete for the log component, and stop
polling once finished.
@coderabbitai

coderabbitai Bot commented Jul 24, 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: d4ea20b3-a567-4a9a-897f-bfa9a8492f20

📥 Commits

Reviewing files that changed from the base of the PR and between 5025824 and 37de4a1.

📒 Files selected for processing (2)
  • app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php
  • app/Filament/Resources/ProductSourceResource/Pages/SearchProductSource.php
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/Filament/Resources/ProductSourceResource/Pages/SearchProductSource.php
  • app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php

📝 Walkthrough

Walkthrough

Search progress synchronization is centralized in both search interfaces, complete searches avoid unnecessary refreshes, dispatch-only log initialization is preserved, and progress views poll every two seconds only until completion.

Changes

Search progress synchronization

Layer / File(s) Summary
Service-backed progress synchronization
app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php, app/Filament/Resources/ProductSourceResource/Pages/SearchProductSource.php
Search execution and refresh paths now synchronize log, in-progress, and completion state through SearchService, while avoiding synchronization after completed searches and initializing dispatch logs only when starting a search.
Completion-aware progress polling
resources/views/filament/resources/product-resource/widgets/create-via-search.blade.php, resources/views/filament/resources/product-source-resource/pages/search-product-source.blade.php
Progress polling runs every two seconds only while searches are incomplete, and the log component receives an explicit boolean completion value.

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

Possibly related PRs

  • jez500/pricebuddy#65: Introduced the search research UI/components and progress-log plumbing used by this synchronization update.
  • jez500/pricebuddy#98: Implemented the related SearchProductSource and CreateViaSearchForm search workflow.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: fixing the search progress UI after jobs complete.
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.

@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: 1

🤖 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 `@app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php`:
- Around line 207-212: Update the status assignments after getInProgress() and
getIsComplete() in CreateViaSearchForm.php (207-212) and SearchProductSource.php
(178-183) to assign each property the service result directly, including false
when absent, instead of updating only for truthy values. This must clear stale
timestamps so the isComplete && ! $inProgress path can run.
🪄 Autofix (Beta)

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: c8c08ed1-f0fa-41ce-a79e-83cddb9ff0ff

📥 Commits

Reviewing files that changed from the base of the PR and between ed901c7 and 5025824.

📒 Files selected for processing (4)
  • app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php
  • app/Filament/Resources/ProductSourceResource/Pages/SearchProductSource.php
  • resources/views/filament/resources/product-resource/widgets/create-via-search.blade.php
  • resources/views/filament/resources/product-source-resource/pages/search-product-source.blade.php

Comment thread app/Filament/Resources/ProductResource/Widgets/CreateViaSearchForm.php Outdated
Assign inProgress/isComplete from the service even when false so a
finished job clears the in-progress timestamp and polling can stop.
@Alien10140

Copy link
Copy Markdown
Contributor Author

Addressed CodeRabbit feedback: syncProgressFromService() now assigns inProgress / isComplete even when the service returns false, so stale in-progress timestamps clear and polling can stop.

@coderabbitai coderabbitai Bot mentioned this pull request Aug 8, 2026
@jez500

jez500 commented Aug 8, 2026

Copy link
Copy Markdown
Owner

thanks, merged here #214 as it needed a bunch of fixes

@jez500 jez500 closed this Aug 8, 2026
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