Skip to content

fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly cp-7.67.2 cp-7.67.3#26979

Merged
FrederikBolding merged 3 commits into
mainfrom
fb/fix-filesystem-storage-patch
Mar 4, 2026
Merged

fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly cp-7.67.2 cp-7.67.3#26979
FrederikBolding merged 3 commits into
mainfrom
fb/fix-filesystem-storage-patch

Conversation

@FrederikBolding

@FrederikBolding FrederikBolding commented Mar 4, 2026

Copy link
Copy Markdown
Member

Description

This PR adjusts our existing patch for redux-persist-filesystem-storage to always return a promise for setItem so it can be awaited correctly, fixing potential race conditions. This was broken when the patch originally was created by adding brackets to an arrow function and not returning. The PR also fixes a bug where not passing in a callback would cause errors to be swallowed. Additionally, this PR moves our existing patch to use the built-in Yarn patch feature (because creating new patches with patch-package seems broken).

Changelog

CHANGELOG entry: Improve reliability of persistence

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Touches persistence write behavior by changing the patched redux-persist-filesystem-storage setItem control flow and error propagation, which could affect app startup/migrations if any callers depend on the old callback-only semantics. Also introduces an iOS-only side effect (exclude-from-backup) after writes.

Overview
This PR updates the Yarn patch for redux-persist-filesystem-storage so setItem always returns a Promise that can be awaited, rather than potentially relying on callback chaining.

It also fixes error handling so write failures are thrown when no callback is provided (instead of being swallowed), and adds an optional isIOS flag to run ReactNativeBlobUtil.ios.excludeFromBackupKey(...) after successful writes on iOS.

Dependency wiring is switched from a normal semver dependency to Yarn’s built-in patch: reference for redux-persist-filesystem-storage@4.2.0, with corresponding yarn.lock updates.

Written by Cursor Bugbot for commit 192a5c8. This will update automatically on new commits. Configure here.

@metamaskbot metamaskbot added the team-core-platform Core Platform team label Mar 4, 2026
@github-actions github-actions Bot added the size-S label Mar 4, 2026
@FrederikBolding FrederikBolding added the skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run label Mar 4, 2026
@FrederikBolding FrederikBolding marked this pull request as ready for review March 4, 2026 12:35
@FrederikBolding FrederikBolding requested a review from a team as a code owner March 4, 2026 12:36

@cursor cursor 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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Comment thread .yarn/patches/redux-persist-filesystem-storage-npm-4.2.0-3a6fff24ab.patch Outdated
@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

⏭️ Smart E2E selection skipped - skip-smart-e2e-selection label found

All E2E tests pre-selected.

View GitHub Actions results

@FrederikBolding FrederikBolding changed the title fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly cp-7.67.2 Mar 4, 2026

@mikesposito mikesposito left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Patch changes look good to me

@sonarqubecloud

sonarqubecloud Bot commented Mar 4, 2026

Copy link
Copy Markdown

@github-actions

github-actions Bot commented Mar 4, 2026

Copy link
Copy Markdown
Contributor

⚠️ E2E Fixture Validation — Structural changes detected

Category Count
New keys 60
Missing keys 0
Type mismatches 0
Value mismatches 7 (informational)

The committed fixture schema is out of date. To update, comment:

@metamaskbot update-mobile-fixture

View full details | Download diff report

- .then(() => callback && callback())
- .catch(error => callback && callback(error)),
+ .then(() => {
+ if (isIOS) ReactNativeBlobUtil.ios.excludeFromBackupKey(pathForKey(key));

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This branch also causes a dangling promise, but I am unsure how to deal with that. We likely do not want to wait for this before returning.

@FrederikBolding FrederikBolding added this pull request to the merge queue Mar 4, 2026
Merged via the queue into main with commit 02ac109 Mar 4, 2026
206 of 211 checks passed
@FrederikBolding FrederikBolding deleted the fb/fix-filesystem-storage-patch branch March 4, 2026 16:21
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 4, 2026
@metamaskbot metamaskbot added the release-7.69.0 Issue or pull request that will be included in release 7.69.0 label Mar 4, 2026
@chloeYue chloeYue changed the title fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly cp-7.67.2 fix: Ensure redux-persist-filesystem-storage returns a promise and throws correctly cp-7.67.2 cp-7.67.3 Mar 5, 2026
@metamaskbot metamaskbot added release-7.68.0 Issue or pull request that will be included in release 7.68.0 and removed release-7.69.0 Issue or pull request that will be included in release 7.69.0 labels Mar 6, 2026
@metamaskbot

Copy link
Copy Markdown
Collaborator

Missing release label release-7.68.0 on PR. Adding release label release-7.68.0 on PR and removing other release labels(release-7.69.0), as PR was cherry-picked in branch 7.68.0.

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

Labels

release-7.68.0 Issue or pull request that will be included in release 7.68.0 size-S skip-smart-e2e-selection Skip Smart E2E selection, i.e. select all E2E tests to run team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants