chore(deps)!: use non-legacy Expo FS in Resource Fetcher, bump SDK version to 56 in demo apps#1222
chore(deps)!: use non-legacy Expo FS in Resource Fetcher, bump SDK version to 56 in demo apps#1222chmjkb wants to merge 11 commits into
Conversation
|
I'll check why CI has diffs on comments in *.h files. This is definitely related to my addition to CI which suppose to check if error codes are regenerated. |
im pretty sure pre-commit does a lint, and yarn codegen:errors returns something that is not yet linted properly:) |
|
|
msluszniak
left a comment
There was a problem hiding this comment.
Actually the reason why CI fails is because you are not rebased on main, please rebase it first ;)
c1ff419 to
7cd0041
Compare
|
Can we drop the In - "@types/react": "~19.1.10",
- "react": "19.1.0",
- "react-native": "0.81.5",
+ "@types/react": "~19.2.0",
+ "react": "19.2.3",
+ "react-native": "0.85.3",I don't think the core package should move off 0.81, for a few reasons:
Could we revert just those three devDep lines and keep the SDK-56 / RN-0.85 bumps scoped to the demo apps and |
While I agree that this PR maybe is not the best place to bump it, since it involves no internal changes I think opening up another PR is frankly a waste of time. Also, I've seen Reanimated and RNGH bump to latest RN versions, so I think it might make sense to bump it. I guess it would make sense to use the latest version to keep up with eventual breaking changes as they come. |
|
Ok, as these are devDeps, we can indeed follow the latest version. Let's keep it. |
msluszniak
left a comment
There was a problem hiding this comment.
A few code-level notes from a pass over the resource-fetcher refactor (separate from the devDep comment above). All non-blocking except possibly the first, which is a genuine question about the new download API's error behavior.
| .then(async (downloadedFile) => { | ||
| // null means the task was paused before completion — resume() will continue it. | ||
| // missing handle means the task was canceled — cancel() already rejected. | ||
| if (!downloadedFile) { |
There was a problem hiding this comment.
Question: does the new downloadAsync() reject on non-2xx responses (404/500), or can it resolve with a File containing the error body? The old implementation explicitly guarded result.status against OK/PARTIAL_CONTENT; here the only non-success case handled is null (pause). If a 404/500 body can resolve successfully, it gets moved to fileUri and cached as a "valid" model — and because handleRemote short-circuits on new File(fileUri).exists, every later fetch then returns the corrupt file (wasDownloaded: false) until a manual delete. If the new API doesn't reject on non-2xx out of the box, it'd be worth restoring an explicit status check (same applies to resume() in ResourceFetcher.ts).
| // null means the task was paused before completion — resume() will continue it. | ||
| // missing handle means the task was canceled — cancel() already rejected. | ||
| if (!downloadedFile) { | ||
| throw new RnExecutorchError( |
There was a problem hiding this comment.
Minor readability: routing the paused case (downloadAsync() resolving null) through throw DownloadInterrupted just to swallow it in .catch when status === PAUSED is a little hard to follow. An explicit early return here when paused (mirroring how resume() handles it in ResourceFetcher.ts) would avoid constructing a throwaway error.
| await downloadedFile.move(new File(fileUri)); | ||
| } catch (error) { | ||
| downloads.delete(source); | ||
| reject(error); |
There was a problem hiding this comment.
Consistency nit: the download .catch below wraps failures in RnExecutorchError(ResourceFetcherDownloadFailed, …, cause), but this move-failure path rejects with the raw error. Worth wrapping it too so callers get a consistent error code/shape.
| export async function checkFileExists(fileUri: string) { | ||
| const fileInfo = await getInfoAsync(fileUri); | ||
| return fileInfo.exists; | ||
| return new File(fileUri).exists; |
There was a problem hiding this comment.
checkFileExists looks unused now — all call sites were inlined to new File(...).exists, so this could be removed. If it's kept, worth noting it's file-only: new File(dir).exists isn't equivalent to the old getInfoAsync for directory paths (which is exactly why createDirectoryIfNoExists correctly switched to Directory).
| @@ -0,0 +1,195 @@ | |||
| /** | |||
There was a problem hiding this comment.
This legacy/ tree duplicates ~500 lines from src/ (ResourceFetcher / handlers / Utils), differing only in the expo-file-system import and a few call shapes. The pause/resume/cancel orchestration is subtle and now lives in two copies that will drift over time. Could the orchestration be shared (some already lives in BaseResourceFetcherClass) with just the FS primitives injected via a thin adapter? At minimum a cross-link comment + a "keep these in sync" note would help.
| typeof (File as unknown as { createDownloadTask?: unknown }) | ||
| .createDownloadTask !== 'function' | ||
| ) { | ||
| throw new RnExecutorchError( |
There was a problem hiding this comment.
This top-level throw runs at module-eval (bundle load / app start), not at fetcher use, and it sits between two import groups (imports are hoisted, so it runs after all of them regardless of placement). Consider moving the check into the class constructor / a lazy init so the module stays import-safe and the error surfaces at instantiation with a cleaner stack. Purely stylistic.
Description
This PR bumps Expo SDK to 56 across all demo apps using Expo. It also refactors the Expo Resource Fetcher to use the aforementioned version. For users using <56, a /legacy import for ExpoResourceFetcher is still available.
Introduces a breaking change?
Type of change
Tested on
Testing instructions
Screenshots
Related issues
Checklist
Additional notes