Skip to content

fix: empty-state Generate button ignores the isCloud restriction - #699

Merged
gkhngyk merged 8 commits into
ansvisor:mainfrom
kn-dev-code:fix/cloud-empty-state-button
Aug 17, 2026
Merged

gkhngyk merged 8 commits into
ansvisor:mainfrom
kn-dev-code:fix/cloud-empty-state-button

Conversation

@kn-dev-code

@kn-dev-code kn-dev-code commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR ensures the empty state "Generate" action respects the isCloud plan restriction on the Content Opportunities page. When isCloud is 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 feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 gkhngyk 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.

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

  1. Revert supabase/migrations/00048_gsc_suggestion_support.sql. That migration has already been applied to the live database. Rewriting it into CREATE TABLE IF NOT EXISTS blocks changes what a fresh install produces versus what production actually has, and it's what turns the schema — consolidated schema.sql is up to date job red. Shipped migrations are append-only; a correction goes in a new numbered file.
  2. Revert supabase/config.toml. Commenting out health_timeout looks like a local workaround for a slow supabase start; it isn't part of this fix.
  3. 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-indented impact.* ternary, and the removed trailing newline at end of file are all unrelated, and together they're what fails web — format, lint & typecheck. Please run yarn format and yarn lint from web/ and keep the diff to the empty-state block.
  4. 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 through t(). Add a key (e.g. content.autoGeneratedHint) to every file under web/messages/ and render it with t('autoGeneratedHint').
  5. Link the issue. The Related issue section is empty — this closes #661, so please add Closes #661 to 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.

@kn-dev-code

kn-dev-code commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor Author

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!

@kn-dev-code
kn-dev-code requested a review from gkhngyk August 11, 2026 17:22

@gkhngyk gkhngyk 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.

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:

  • debouncedSearch state and the useEffect that debounces it
  • filters.q = debouncedSearch.trim() — so q is never sent to the server any more
  • debouncedSearch from the usePagination reset key and from loadData'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.

@kn-dev-code

Copy link
Copy Markdown
Contributor Author

Alright let's give it another go!

@kn-dev-code
kn-dev-code requested a review from gkhngyk August 13, 2026 22:25

@gkhngyk gkhngyk 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.

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.

@kn-dev-code

Copy link
Copy Markdown
Contributor Author

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.

@kn-dev-code
kn-dev-code requested a review from gkhngyk August 15, 2026 15:43
gkhngyk
gkhngyk previously approved these changes Aug 16, 2026

@gkhngyk gkhngyk 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.

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.

@kn-dev-code
kn-dev-code requested a review from gkhngyk August 16, 2026 16:22
@kn-dev-code

Copy link
Copy Markdown
Contributor Author

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 gkhngyk 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.

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 — the loading guard, the RefreshCw icon and the regenerate label all survived this round.
  • Both paths into handleGenerate are now behind !isCloud, which is exactly the gap #661 described: the header button always had the guard, the empty-state one never did.
  • The autoGeneratedHint key is in messages/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.

@gkhngyk
gkhngyk merged commit 40bf2d5 into ansvisor:main Aug 17, 2026
3 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.

Content: empty-state Generate button ignores the isCloud restriction

2 participants