Fix native image upload router helper#96
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 35 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe PR reorganizes auth module imports to a centralized library location, refactors image upload mechanisms from XHR/fetch to Expo FileSystem API with Promise-based cancellation, adds Expo configuration inheritance to TypeScript, and updates Expo-related dependencies. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@frontend/app/profile/edit.tsx`:
- Around line 69-78: The timeout Promise currently clears its timer immediately
via Promise.resolve().finally, preventing the timeout from ever firing; fix by
creating a single uploadPromise = task.uploadAsync() (so upload isn't started
twice), create timeoutPromise that only clears its timer when it actually fires
or when the overall race settles, then run Promise.race([uploadPromise,
abortPromise, timeoutPromise]) and ensure after the race settles you clear the
timeout and, on timeout rejection, call task.cancelAsync(). Use the existing
symbols uploadPromise, task.uploadAsync, timeoutPromise, abortPromise,
timeoutMs, and task.cancelAsync to implement this cleanup and avoid starting
uploadAsync twice.
In `@frontend/components/ImageUploader.tsx`:
- Around line 233-237: The FileSystem calls (FileSystem.getInfoAsync and
FileSystem.createUploadTask) are being invoked for blob: URLs created on web,
which fail; add a Platform.OS === 'web' guard around the validation and upload
logic: if Platform.OS === 'web' detect blob URLs via manipulated.uri and use
fetch() to read the blob and stream/upload via web APIs instead of calling
FileSystem.getInfoAsync or FileSystem.createUploadTask; keep the existing native
path flow (getInfoAsync, size check, createUploadTask) for non-web platforms and
ensure manipulated.uri is routed appropriately in both branches.
In `@frontend/package.json`:
- Around line 40-44: The root-level lockfile contains stale entries for
react-native-reanimated@4.3.0 and react-native-worklets@0.8.1 while
frontend/package.json and frontend/node_modules expect
react-native-reanimated@4.2.1 and react-native-worklets@0.7.2; run npm install
at the workspace root to regenerate the lockfile, ensuring the lockfile and root
node_modules are updated to match the frontend dependencies, then verify the
lockfile no longer contains the old versions and that only
react-native-reanimated@4.2.1 and react-native-worklets@0.7.2 are resolved
across the workspace.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: a27d55d3-de86-46f2-9533-c817844dfab3
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
frontend/app/auth/__tests__/loginRedirect.test.tsfrontend/app/auth/login.tsxfrontend/app/profile/edit.tsxfrontend/components/ImageUploader.tsxfrontend/lib/auth/loginRedirect.tsfrontend/package.jsontsconfig.json
Linked Issues
Closes #
Linear: POLY-89
Summary
Fixes native image upload failures in the Expo app and removes an Expo Router warning caused by a non-route helper living under
app/.The main bug was that listing and profile photo uploads could appear to succeed, but the stored file bytes were malformed on Android, which caused uploaded images to fail rendering later with
unknown image format. The fix switches native uploads to Expo's native binary file upload path so manipulated local image files are sent correctly to Convex storage.This PR also moves
app/auth/loginRedirect.tsinto a non-route location underlib/auth/and updates imports/tests so Expo Router no longer treats it like a screen.How to Test
Steps to verify locally:
npm run lintnpm run typechecknpm testManual flow:
npm run dev:backend(in terminal A)npm run dev(in terminal B)app/auth/loginRedirect.tsChecklist
npm run lint)devScreenshots / Demos
Attach before/after screenshots showing:
Summary by CodeRabbit
New Features
Bug Fixes
Chores