Skip to content

Commit 27b4d21

Browse files
esprehnfacebook-github-bot
authored andcommitted
Always write the manifest in multiRemove (#18613)
Summary: RCTAsyncLocalStorage did not write the manifest after removing a value that was larger than RCTInlineValueThreshold. This meant that the values would still be on disk as null in the manifest.json, and if the app didn't do anything to make the manifest get written out again the null values would persist in the AsyncStorage and be returned by getAllKeys. We need to always write out the manifest.json even if the value is in the overflow storage files. Thank you for sending the PR! We appreciate you spending the time to work on these changes. Help us understand your motivation by explaining why you decided to make this change. Fixes #9196. Not sure where the tests are for this? none. [IOS] [BUGFIX] [AsyncStorage] - Correctly remove keys of large values from AsyncStorage. tadeuzagallo nicklockwood dannycochran Pull Request resolved: #18613 Differential Revision: D13860820 Pulled By: cpojer fbshipit-source-id: ced1cd40273140335cd9b1f29fc1c1881ab8cebd
1 parent 7b8235a commit 27b4d21

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

React/Modules/RCTAsyncLocalStorage.m

+2-4
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,8 @@ - (NSDictionary *)_writeEntry:(NSArray<NSString *> *)entry changedManifest:(BOOL
423423
NSString *filePath = [self _filePathForKey:key];
424424
[[NSFileManager defaultManager] removeItemAtPath:filePath error:nil];
425425
[RCTGetCache() removeObjectForKey:key];
426-
// remove the key from manifest, but no need to mark as changed just for
427-
// this, as the cost of checking again next time is negligible.
428-
[_manifest removeObjectForKey:key];
429-
} else if (_manifest[key]) {
426+
}
427+
if (_manifest[key]) {
430428
changedManifest = YES;
431429
[_manifest removeObjectForKey:key];
432430
}

0 commit comments

Comments
 (0)