Skip to content

Use Supabase views for review queues and split reviews page into new vs. existing edits - #45

Open
tayloraj10 wants to merge 4 commits into
mainfrom
supabase-edits-views-usage
Open

Use Supabase views for review queues and split reviews page into new vs. existing edits#45
tayloraj10 wants to merge 4 commits into
mainfrom
supabase-edits-views-usage

Conversation

@tayloraj10

@tayloraj10 tayloraj10 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Use Supabase views for review queues and split reviews page into new vs. existing edits

Problem

The reviews and dashboard pages were pulling data by scanning the full resource_edits table directly, rather than using the purpose-built resource_edit_counts and resource_change_log views. The reviews index page also lumped new site submissions and edits to existing resources into a single table, making it harder to review either group on its own.

Solution

  • Switched the reviews and dashboard loaders to pull from the resource_edit_counts and resource_change_log views via new getEditCounts, getChangeLog, and getChangeLogForResource API methods, instead of scanning resource_edits directly.
  • Split the reviews index page into two separate tables — "New site submissions" and "Edits to existing resources" — each with its own columns, including a "Pending edits" count for resources with multiple competing edits.
  • Added a change-log audit trail to the review detail page using the new view-backed data.

Reference

Closes #43. Partially addresses #35 (splits new-resource vs. existing-edit review queues; the duplicate-detection confidence rating from #35 is not part of this PR).

Screenshots

Screenshot 2026-08-11 214826

Checklist

  • Changes have been tested locally
  • Changes have been self-reviewed

Convert the "Save changes" button on the review detail page from a
bare onClick handler to a <fetcher.Form onSubmit>, matching the
approve/reject actions that already use <Form>. The payload is a
nested object rather than flat fields, so it's still sent as JSON via
fetcher.submit, but routing it through a real form gives us proper
submit semantics (Enter-to-submit, pending state, progressive
enhancement) instead of a plain button click.

Also swap the deprecated FormEvent type for SubmitEvent, and convert
logout to a POST action (was a GET loader) triggered via a <Form> in
the sidebar, since a GET route shouldn't perform a mutation like
signing out.
- Introduced new API methods for fetching edit counts and change logs, enhancing the resource edit management capabilities.
- Updated the dashboard to utilize these new methods, allowing for a comprehensive view of pending edits and historical changes.
- Modified the reviews detail page to display the change log for individual resources, improving audit trail visibility.
- Enhanced the reviews index page to show pending edit counts for resources, aiding in resource management and review prioritization.
- Introduced separate types for edit and new row data, improving type safety and clarity.
- Updated table columns to include a submitted date for both edits and new resources, enhancing the review process.
- Refactored the ReviewQueueTable component to handle sorting and rendering more efficiently.
- Improved the overall layout by incorporating a Stack component for better spacing and organization.
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.

Use supabase DB views for data pulling instead of calculating on frontend code

1 participant