Repository navigation
fix: empty-state Generate button ignores the isCloud restriction - #699
Conversation
There was a problem hiding this comment.
Welcome to Ansvisor, and thank you for your first PR! A maintainer will be by soon to review.
In the meantime, two things that make review faster:
- A short description of why the change matters, not just what it does — most of our PRs link a
Fixes #...to the issue that explains the why. - A quick local test note if there's anything worth eyeballing in the browser.
If you'd like to keep an eye on where Ansvisor goes next, a ⭐ on the repo helps others discover it (and Watch sends you a ping when related issues land). Either way — looking forward to your next one.
gkhngyk
left a comment
There was a problem hiding this comment.
The fix itself is correct — the header Generate button is already behind !isCloud, the empty-state one wasn't, so it's a real gap. But the PR carries a lot of unrelated change and CI is red on two jobs, so it can't be merged as is.
Must fix
- Revert
supabase/migrations/00048_gsc_suggestion_support.sql. That migration has already been applied to the live database. Rewriting it intoCREATE TABLE IF NOT EXISTSblocks changes what a fresh install produces versus what production actually has, and it's what turns theschema — consolidated schema.sql is up to datejob red. Shipped migrations are append-only; a correction goes in a new numbered file. - Revert
supabase/config.toml. Commenting outhealth_timeoutlooks like a local workaround for a slowsupabase start; it isn't part of this fix. - Revert the editor reformatting in
content/page.tsx.catch {}→catch { },min-h-[400px]→min-h-100,w-[130px]→w-32.5,w-[120px]→w-30,w-[110px]→w-27.5, the re-indentedimpact.*ternary, and the removed trailing newline at end of file are all unrelated, and together they're what failsweb — format, lint & typecheck. Please runyarn formatandyarn lintfromweb/and keep the diff to the empty-state block. - Use i18n for the new copy.
Opportunities are generated automatically as your tracking data comes in.is a hardcoded English string on a page that goes throught(). Add a key (e.g.content.autoGeneratedHint) to every file underweb/messages/and render it witht('autoGeneratedHint'). - Link the issue. The Related issue section is empty — this closes #661, so please add
Closes #661to the description so the issue closes on merge.
Note
Once the noise is gone the remaining diff should be roughly the ten lines around the {!isCloud ? ... : ...} block, which is exactly what the issue asks for. Ping me when CI is green and I'll take another look.
…loud restrictions
|
Thanks for the thorough review and clear feedback! I made some local workaround edits while setting up Supabase locally and accidentally left them in the branch. I've made the changes per request:
I'm ready for another look! |
gkhngyk
left a comment
There was a problem hiding this comment.
Thanks — the migration and config.toml are gone, and the translation key is done properly. Two things left, one of them serious.
Blocking: the search box stopped working
The latest commits also delete the debounced server-side search that exists on main:
debouncedSearchstate and theuseEffectthat debounces itfilters.q = debouncedSearch.trim()— soqis never sent to the server any moredebouncedSearchfrom theusePaginationreset key and fromloadData's dependency list
Confirmed against origin/main, where all four are present (lines 165, 172, 191–192, 215). Typing in the Content search box now filters nothing — the request goes out without the query, and the page keeps showing whatever the unfiltered page returned.
This looks like the file was restored from a pre-rebase copy rather than the current main while reverting the unrelated changes. Rebasing onto main and re-applying only the empty-state block should bring it back.
Prettier is what's failing CI
The web job fails on exactly one file, and only on formatting:
[warn] src/app/[locale]/(dashboard)/dashboard/content/page.tsx
Code style issues found in the above file.
Three leftovers: catch {} → catch { } in saveGenerationJob and clearGenerationJob, and the re-indented impact.high | impact.medium | impact.low union in the badge. yarn format from web/ fixes all three.
Also
The Related issue section is still empty — please add Closes #661 so the issue closes on merge.
The empty-state change itself is right and reads well. Once search is back and CI is green this is good to go.
…t empty state button
|
Alright let's give it another go! |
gkhngyk
left a comment
There was a problem hiding this comment.
Search is back and matches main, the migration and config.toml are reverted, CI is green, and the empty-state fix itself reads correctly. Diffed against origin/main rather than the PR view, so this is the real remaining delta — one regression, in the other button.
Blocking: the header Generate button lost three things
Not the empty-state one this issue is about — the one next to Webhook. Against origin/main:
main |
this PR |
|---|---|
disabled={generating || loading} |
disabled={generating} |
RefreshCw icon once opportunities exist |
always Lightbulb |
t('regenerate') — "Refresh Opportunities" |
always "Generate Opportunities" |
So the button is clickable while the list is still loading, and refreshing an existing set is labelled as generating a new one. RefreshCw is now imported and never used, and the regenerate translation key has no reader left.
This looks like the same stale-copy problem as last time — the file moved on main and the edit was made against an older version. Rebasing onto current main and re-applying only the empty-state block should resolve it; nothing about this issue requires touching the header button at all.
Non-blocking
The cloud hint now also renders in the header, permanently, beside the Webhook button — including when opportunities already exist. In the empty state it explains why there is no button; in the header it is a standing sentence that repeats itself once the empty state is gone. Keeping it to the empty state would read better, but your call.
Also
The Related issue section still holds the template comment rather than Closes #661, so the issue won't close on merge.
The empty-state change is right and the cleanup since the last review is a real improvement — this is the last thing.
|
Ok @gkhngyk, everything per request should be updated! Please let me know if there are any changes to be made before I resolve conflicts and merge. |
gkhngyk
left a comment
There was a problem hiding this comment.
The header button is restored — disabled={generating || loading}, the RefreshCw icon and the regenerate label all match origin/main again. Search was already back in the previous round. Closes #661 is in the description. That is everything I asked for, so this is approved.
I merged it locally against current main to check what is left. One conflict, and it is trivial:
web/src/app/[locale]/(dashboard)/dashboard/content/page.tsx
The // Server-side paging (#610) comment lost its indentation in this branch, so it collides with the same lines on main. Resolving in favour of main is correct — nothing about this fix needs that comment moved. With that one hunk resolved, the merged result passes typecheck, lint, build, and format:check after a single yarn format (one more comment, // Restore generation state from localStorage on mount, also picked up a stray leading space).
So: rebase onto main, keep main's version of both comments, run yarn format from web/, and this is ready.
The empty-state change itself reads well and the autoGeneratedHint key is wired properly across the message files. Thanks for sticking with it through three rounds of review — the final diff is exactly the ten lines the issue called for.
|
Thank you so much @gkhngyk for being patient with me! I really appreciate the guidance you've offered me, and I've learned a lot. If it is ok, I would love to keep assisting with any issues you may have. |
gkhngyk
left a comment
There was a problem hiding this comment.
Rebased cleanly, CI is green, and the net diff is two files — the ten-line empty-state block plus one translation key. Re-approving, since the previous approval was dropped by the rebase.
Verified against current origin/main rather than the PR view:
- The header Generate button is byte-identical to
main— theloadingguard, theRefreshCwicon and theregeneratelabel all survived this round. - Both paths into
handleGenerateare now behind!isCloud, which is exactly the gap #661 described: the header button always had the guard, the empty-state one never did. - The
autoGeneratedHintkey is inmessages/en.json, the only message file in the repo.
The two whitespace hunks (a blank line before the localStorage comment, and the spacing inside handleBulkDone) are unrelated to the fix, but they are the shape Prettier settles on and CI's format check agrees, so they are fine to carry.
Thanks for working through the reverts and the rebase — good to merge.
Summary
This PR ensures the empty state "Generate" action respects the
isCloudplan restriction on the Content Opportunities page. WhenisCloudis true, the manual generate button is replaced with an explanatory message informing the user that opportunities are created automatically from incoming tracking data.Related issue
Closes #661
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsChecklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)