Skip to content

Commit b5e7e19

Browse files
authored
make new variables optional (#7521)
## Explanation The `localOverrides` and `rawRemoteFeatureFlags` properties were recently added to `RemoteFeatureFlagControllerState` in PR #7271 as required properties. However, consumers with existing persisted state from before these properties were added will experience TypeScript errors when their state is loaded, since these properties won't exist in the persisted data but are marked as required. This PR marks `localOverrides` and `rawRemoteFeatureFlags` as optional in the `RemoteFeatureFlagControllerState` type to ensure backwards compatibility with existing persisted state. The `getDefaultRemoteFeatureFlagControllerState()` function continues to initialize these properties with empty objects, so newly created state will still have them populated. ## References - Related to #7271 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs) - [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
1 parent c7eb5c6 commit b5e7e19

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/remote-feature-flag-controller/src/remote-feature-flag-controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ export const DEFAULT_CACHE_DURATION = 24 * 60 * 60 * 1000; // 1 day
2828

2929
export type RemoteFeatureFlagControllerState = {
3030
remoteFeatureFlags: FeatureFlags;
31-
localOverrides: FeatureFlags;
32-
rawRemoteFeatureFlags: FeatureFlags;
31+
localOverrides?: FeatureFlags;
32+
rawRemoteFeatureFlags?: FeatureFlags;
3333
cacheTimestamp: number;
3434
};
3535

0 commit comments

Comments
 (0)