Skip to content

refactor: update chat shortcut initialization and add Supabase type definitions - #1825

Open
TanCodeX wants to merge 4 commits into
durdana3105:mainfrom
TanCodeX:fix/typescript-build-and-tests
Open

refactor: update chat shortcut initialization and add Supabase type definitions#1825
TanCodeX wants to merge 4 commits into
durdana3105:mainfrom
TanCodeX:fix/typescript-build-and-tests

Conversation

@TanCodeX

@TanCodeX TanCodeX commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

🐛 Description

Closes #1777

This pull request addresses several recent regressions that caused the production build and the test suite to fail. The primary issue was a corrupted Supabase types file (due to a bad merge commit), which had cascading effects across the frontend. This PR fixes the type definitions, resolves all resulting TypeScript errors, and patches a broken test in the Contact page.

🛠️ Changes Made

  • Restored Supabase Types (types.ts):
    • Restored missing skill_endorsements and resources definitions that were dropped in a recent merge.
    • Added the missing submit_peer_review RPC function definition.
    • Added the newly created testimonials table definition to align the frontend with the 20260718000000_create_testimonials.sql migration.
  • Fixed Chat.tsx: Moved the useChatShortcuts hook invocation below the declarations of selectUser and filteredUsers to fix a "variable used before declaration" TypeScript error.
  • Fixed RecentActivity.tsx: Updated the query on the resources table to filter by uploaded_by instead of user_id to match the latest schema.
  • Fixed AvatarUpload.tsx: Added the missing import for API_BASE_URL from @/config/api.
  • Fixed Contact.test.tsx: Safely handled the missing clear method on the mocked localStorage object by adding optional chaining (localStorage?.clear?.()), fixing the TypeError: localStorage?.clear is not a function crash in the test runner.

✅ Verification

  • npm run build now completes successfully on the main branch with 0 errors.
  • Vercel deployments will now pass correctly.
  • npm run test executes cleanly, and all 260 tests are passing.

Summary by CodeRabbit

  • Bug Fixes

    • Corrected the Recent Activity feed so resources uploaded by the current user appear reliably.
    • Improved handling of profile avatar upload requests.
    • Improved chat shortcut behavior when selecting users and returning to the conversation list.
  • Reliability

    • Added safer handling for browser storage cleanup during contact-page operations.

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown

@TanCodeX is attempting to deploy a commit to the durdana3105's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@TanCodeX, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b72acb9f-2a33-48d0-b3af-0a8a52a2b93c

📥 Commits

Reviewing files that changed from the base of the PR and between 5c3e2ce and e6c7066.

📒 Files selected for processing (4)
  • src/components/AvatarUpload.tsx
  • src/pages/aipage.tsx
  • supabase_types.ts
  • tailwind.config.ts
📝 Walkthrough

Walkthrough

The PR updates upload configuration imports, resource activity filtering, chat shortcut placement, and test cleanup. It also adds generated Supabase schema types, generic type helpers, constants, and an authentication error payload across several files.

Changes

Application fixes

Layer / File(s) Summary
Upload and activity data wiring
src/components/AvatarUpload.tsx, src/components/dashboard/RecentActivity.tsx
Avatar upload URL construction now imports API_BASE_URL, and resource activity queries filter by uploaded_by.
Chat shortcut hook placement
src/pages/Chat.tsx
The existing useChatShortcuts invocation is moved later in the component without changing its configuration.
Safe test storage cleanup
src/pages/Contact.test.tsx
Test setup safely invokes localStorage.clear when both the storage object and method exist.

Supabase type artifacts

Layer / File(s) Summary
Primary Supabase schema definitions
src/integrations/supabase/types.ts
Adds generated JSON, database schema, table/view/function definitions, generic resolvers, and constants.
Alternate generated schema snapshots
temp_types.ts, temp2_types.ts
Adds additional generated Supabase database types and generic table, enum, composite, and constant helpers.
Supabase authentication output
supabase_types.ts
Records a missing access token error with authentication guidance.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested labels: gssoc26, gssoc:approved, quality:clean, type:bug, level:intermediate

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR includes unrelated chat, avatar upload, recent activity, and test changes that are outside issue #1777's Supabase typing scope. Split those unrelated edits into separate PRs or justify them in the linked issue scope, keeping this PR focused on the Supabase type fix.
✅ 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 covers the two main visible changes: chat shortcut initialization and Supabase type definitions.
Linked Issues check ✅ Passed The Supabase type regeneration appears to restore the missing database objects needed for the build failure fix in #1777.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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 `@supabase_types.ts`:
- Line 1: Delete the three accidental root-level artifacts: supabase_types.ts,
temp_types.ts, and temp2_types.ts. Keep the canonical
src/integrations/supabase/types.ts as the sole Supabase type definition source;
no replacement code is needed in the deleted files.
🪄 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: 91174b5e-8b54-4957-a677-750615b43066

📥 Commits

Reviewing files that changed from the base of the PR and between 4518872 and 5c3e2ce.

📒 Files selected for processing (8)
  • src/components/AvatarUpload.tsx
  • src/components/dashboard/RecentActivity.tsx
  • src/integrations/supabase/types.ts
  • src/pages/Chat.tsx
  • src/pages/Contact.test.tsx
  • supabase_types.ts
  • temp2_types.ts
  • temp_types.ts

Comment thread supabase_types.ts Outdated
@@ -0,0 +1 @@
{"_tag":"Error","error":{"code":"LegacyPlatformAuthRequiredError","message":"Access token not provided. Supply an access token by running `supabase login` or setting the SUPABASE_ACCESS_TOKEN environment variable."}}

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.

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Remove the three accidental Supabase type-gen artifacts from the repo root. These files are leftovers from a manual/failed supabase gen types session and are unrelated to the canonical src/integrations/supabase/types.ts; keeping them causes drift (duplicate, divergent Database/Json/Tables definitions) and one is not even valid TypeScript.

  • supabase_types.ts#L1-L1: delete — it's an error JSON payload (failed auth), not types; regenerate after supabase login/SUPABASE_ACCESS_TOKEN if needed.
  • temp_types.ts#L1-L9: delete — stale duplicate missing skill_endorsements, testimonials, skill_endorsement_counts, and submit_peer_review.
  • temp2_types.ts#L1-L9: delete — stale duplicate missing testimonials and submit_peer_review.
🧰 Tools
🪛 Biome (2.5.3)

[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none

(parse)


[error] 1-1: Expected a semicolon or an implicit semicolon after a statement, but found none

(parse)

📍 Affects 3 files
  • supabase_types.ts#L1-L1 (this comment)
  • temp_types.ts#L1-L9
  • temp2_types.ts#L1-L9
🤖 Prompt for 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.

In `@supabase_types.ts` at line 1, Delete the three accidental root-level
artifacts: supabase_types.ts, temp_types.ts, and temp2_types.ts. Keep the
canonical src/integrations/supabase/types.ts as the sole Supabase type
definition source; no replacement code is needed in the deleted files.

…int disables from configuration and UI files
@durdana3105

Copy link
Copy Markdown
Owner

RESOLVE MERGE CONFLICTS

@TanCodeX

Copy link
Copy Markdown
Contributor Author

RESOLVE MERGE CONFLICTS

@durdana3105 DONE

@durdana3105

Copy link
Copy Markdown
Owner

RESOLVE MERGE CONFLICTS

@TanCodeX

Copy link
Copy Markdown
Contributor Author

RESOLVE MERGE CONFLICTS

@durdana3105 Done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: Restore missing skill_endorsements table and submit_peer_review RPC to resolve TypeScript build failures

2 participants