Skip to content

generate summary button replaced with tooltip if item count isn't met - #344

Merged
ND68 merged 1 commit into
mainfrom
Nathan/337-generate-summary-button
Apr 14, 2026
Merged

ND68 merged 1 commit into
mainfrom
Nathan/337-generate-summary-button

Conversation

@ND68

@ND68 ND68 commented Apr 14, 2026

Copy link
Copy Markdown
Collaborator

Description

Resolves ticket number: #337

Explain what your code changes: The generate summary button on the wishlists page is replaced with a tooltip if item count isn't high enough to generate a summary yet

List the steps you took to test your code: visual confirmation

Checklist

  • [x ] The ticket is mentioned above
  • [ x] The changes fulfill the success criteria of the ticket
  • [ x] The changes were self-reviewed
  • [ x] A review was requested

@ND68 ND68 linked an issue Apr 14, 2026 that may be closed by this pull request
@netlify

netlify Bot commented Apr 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for hope-for-haiti ready!

Name Link
🔨 Latest commit 646a2c8
🔍 Latest deploy log https://app.netlify.com/projects/hope-for-haiti/deploys/69ddad2ab3b1c80008ccb5fc
😎 Deploy Preview https://deploy-preview-344--hope-for-haiti.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@greptile-apps

greptile-apps Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR replaces the always-visible WishlistSummary button with a conditional render: the button appears only when the wishlist has ≥ 10 entries, and a react-tooltip-powered question mark icon is shown otherwise.

  • P1 — filter-dependent visibility bug: totalItems is updated on every fetchFn call using the filtered response.total. Applying filters that reduce visible rows below 10 hides the summary button even when ≥ 10 total wishlists exist, while the AI endpoint /api/wishlists/summary always summarises all wishlists regardless of filters. The total should be fetched independently of the filtered query.
  • P2 — initial-load flash: totalItems starts as null, so the question-mark icon always renders briefly on page load before the first fetch returns, causing a visible flicker for users who have ≥ 10 wishlists.
  • P2 — hardcoded threshold: The value 10 is duplicated in both the condition and the tooltip string; extracting it as a named constant would prevent drift.

Confidence Score: 4/5

  • The PR has a P1 logic bug where filtering the table can incorrectly hide the summary button despite the feature remaining available.
  • A single P1 issue is present: the summary button's visibility is driven by the filtered row count rather than the true total, making the feature appear unavailable when filters are active. This should be fixed before merging to avoid confusing users.
  • src/screens/Wishlist/AdminWishlistScreen.tsx — specifically the totalItems state and its interaction with filtered fetch results.

Important Files Changed

Filename Overview
src/screens/Wishlist/AdminWishlistScreen.tsx Conditionally renders WishlistSummary based on totalItems state; has a P1 bug where applying filters can drop the total below 10 and incorrectly hide the summary button even when ≥10 total wishlists exist.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant AWC as AdminWishlistScreen
    participant ABT as AdvancedBaseTable
    participant API as /api/wishlists
    participant SAPI as /api/wishlists/summary

    U->>AWC: "Page load (totalItems = null → shows tooltip icon)"
    AWC->>ABT: render with fetchFn
    ABT->>API: "GET /api/wishlists?pageSize=...&page=...&filters=[]"
    API-->>ABT: "{ wishlists, total }"
    ABT->>AWC: setTotalItems(response.total)
    alt "total >= 10"
        AWC->>U: Render WishlistSummary button
        U->>AWC: Click "Generate Summary"
        AWC->>SAPI: stream /api/wishlists/summary (all items, no filters)
        SAPI-->>AWC: streamed text chunks
    else "total < 10"
        AWC->>U: Render tooltip question-mark icon
    end
    U->>ABT: "Apply filter (e.g. priority=high → 8 results)"
    ABT->>API: "GET /api/wishlists?filters=[priority=high]"
    API-->>ABT: "{ wishlists, total: 8 }"
    ABT->>AWC: setTotalItems(8)
    Note over AWC,U: Bug: button hidden even though 15 total wishlists exist and summary is still available
Loading

Reviews (1): Last reviewed commit: "generate summary button replaced with to..." | Re-trigger Greptile

Comment thread src/screens/Wishlist/AdminWishlistScreen.tsx
Comment thread src/screens/Wishlist/AdminWishlistScreen.tsx
Comment thread src/screens/Wishlist/AdminWishlistScreen.tsx
@ND68
ND68 merged commit a77f01e into main Apr 14, 2026
5 checks passed
@ND68
ND68 deleted the Nathan/337-generate-summary-button branch April 14, 2026 15:11
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.

Resize Window Changes Generate Summary Placement

1 participant