Skip to content

Commit e8423a6

Browse files
nickmisasiclaude
andauthored
Fix 16KB page size patch failing due to stale diff context (#9555)
The expo_image/index.tsx hunks in 9325-full.diff were generated before the NetworkManager/header-handling code was added to ExpoImage. The stale context lines caused patch's fuzzy matching to apply ExpoImage hunks to ExpoImageBackground instead, then ExpoImageBackground hunks failed because those sections were already modified. Regenerated the expo_image diff hunks to match the current file state with proper context lines for both ExpoImage (with header handling) and ExpoImageBackground components. https://claude.ai/code/session_01SGXWQzxrcPpWsq2YrjoUwd Co-authored-by: Claude <noreply@anthropic.com>
1 parent 33dcfb2 commit e8423a6

File tree

1 file changed

+23
-17
lines changed

1 file changed

+23
-17
lines changed

scripts/android-16kb-pagesize/9325-full.diff

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ index 08eb45fcd9..914911c17a 100644
3636
+ ]
3737
}
3838
diff --git a/app/components/expo_image/index.tsx b/app/components/expo_image/index.tsx
39-
index 9dbffd7ca6..bd70fffb9c 100644
39+
index b2723fb..1ed5e15 100644
4040
--- a/app/components/expo_image/index.tsx
4141
+++ b/app/components/expo_image/index.tsx
42-
@@ -8,6 +8,8 @@ import Animated from 'react-native-reanimated';
43-
import {useServerUrl} from '@context/server';
42+
@@ -9,6 +9,8 @@ import {useServerUrl} from '@context/server';
43+
import NetworkManager from '@managers/network_manager';
4444
import {urlSafeBase64Encode} from '@utils/security';
45-
45+
4646
+import type {SharedRefType} from 'expo';
4747
+
4848
type ExpoImagePropsWithId = ImageProps & {id: string};
4949
type ExpoImagePropsMemoryOnly = ImageProps & {cachePolicy: 'memory'; id?: string};
5050
type ExpoImageProps = ExpoImagePropsWithId | ExpoImagePropsMemoryOnly;
51-
@@ -25,13 +27,13 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
51+
@@ -54,8 +56,8 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
5252
* for filesystem path compatibility (avoiding special characters in directory names).
5353
*/
5454
const cachePath = useMemo(() => urlSafeBase64Encode(serverUrl), [serverUrl]);
@@ -58,31 +58,37 @@ index 9dbffd7ca6..bd70fffb9c 100644
5858
+ if (typeof props.source === 'number' || typeof props.source === 'string' || Array.isArray(props.source) || !props.source) {
5959
return props.source;
6060
}
61-
61+
62+
@@ -63,7 +65,7 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
63+
delete sourceHeaders?.Accept;
64+
6265
// Only add cacheKey and cachePath if id is provided (i.e., not memory-only caching)
6366
- if (id) {
6467
+ if (id && typeof props.source === 'object' && 'uri' in props.source) {
6568
return {
6669
...props.source,
67-
cacheKey: id,
68-
@@ -43,13 +45,13 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
69-
}, [id, props.source, cachePath]);
70-
70+
headers: sourceHeaders,
71+
@@ -79,8 +81,8 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
72+
}, [id, props.source, cachePath, requestHeaders, serverUrl]);
73+
7174
// Process placeholder to add cachePath and cacheKey if it has a uri
7275
- const placeholder: ImageSource | undefined = useMemo(() => {
7376
- if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string') {
7477
+ const placeholder: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
7578
+ if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string' || Array.isArray(props.placeholder)) {
7679
return props.placeholder;
7780
}
78-
81+
82+
@@ -88,7 +90,7 @@ const ExpoImage = forwardRef<Image, ExpoImageProps>(({id, ...props}, ref) => {
83+
delete placeholderHeaders?.Accept;
84+
7985
// If placeholder has a uri and id is provided, add cachePath and cacheKey
8086
- if (props.placeholder.uri && id) {
8187
+ if (typeof props.placeholder === 'object' && 'uri' in props.placeholder && props.placeholder.uri && id) {
8288
return {
8389
...props.placeholder,
84-
cacheKey: `${id}-thumb`,
85-
@@ -74,13 +76,13 @@ ExpoImage.displayName = 'ExpoImage';
90+
headers: placeholderHeaders,
91+
@@ -117,13 +119,13 @@ ExpoImage.displayName = 'ExpoImage';
8692
const ExpoImageBackground = ({id, ...props}: ExpoImageBackgroundProps) => {
8793
const serverUrl = useServerUrl();
8894
const cachePath = useMemo(() => urlSafeBase64Encode(serverUrl), [serverUrl]);
@@ -92,24 +98,24 @@ index 9dbffd7ca6..bd70fffb9c 100644
9298
+ if (typeof props.source === 'number' || typeof props.source === 'string' || Array.isArray(props.source) || !props.source) {
9399
return props.source;
94100
}
95-
101+
96102
// Only add cacheKey and cachePath if id is provided (i.e., not memory-only caching)
97103
- if (id) {
98104
+ if (id && typeof props.source === 'object' && 'uri' in props.source) {
99105
return {
100106
...props.source,
101107
cacheKey: id,
102-
@@ -92,13 +94,13 @@ const ExpoImageBackground = ({id, ...props}: ExpoImageBackgroundProps) => {
108+
@@ -135,13 +137,13 @@ const ExpoImageBackground = ({id, ...props}: ExpoImageBackgroundProps) => {
103109
}, [id, props.source, cachePath]);
104-
110+
105111
// Process placeholder to add cachePath and cacheKey if it has a uri
106112
- const placeholder: ImageSource | undefined = useMemo(() => {
107113
- if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string') {
108114
+ const placeholder: ImageSource | string | number | ImageSource[] | string[] | SharedRefType<'image'> | null | undefined = useMemo(() => {
109115
+ if (!props.placeholder || typeof props.placeholder === 'number' || typeof props.placeholder === 'string' || Array.isArray(props.placeholder)) {
110116
return props.placeholder;
111117
}
112-
118+
113119
// If placeholder has a uri and id is provided, add cachePath and cacheKey
114120
- if (props.placeholder.uri && id) {
115121
+ if (typeof props.placeholder === 'object' && 'uri' in props.placeholder && props.placeholder.uri && id) {

0 commit comments

Comments
 (0)