Skip to content

Commit e5f394c

Browse files
authored
fix: Allow null in InputChangeEvent value field (#3722)
This fixes an old issue where `null` is not allowed as a valid value in the `InputChangeEvent` <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Allow `null` for `InputChangeEvent.value`, add tests, update changelogs, and refresh example snap bundle shasums. > > - **SDK / Types**: > - Allow `null` in `InputChangeEvent` by making `value` `nullable` in `InputChangeEventStruct` (`packages/snaps-sdk/src/types/handlers/user-input.ts`). > - Add unit test to validate `null` acceptance (`packages/snaps-sdk/src/types/handlers/user-input.test.ts`). > - **Changelogs**: > - Note fix in `packages/snaps-sdk/CHANGELOG.md` and `packages/snaps-execution-environments/CHANGELOG.md`. > - **Examples**: > - Update `source.shasum` for example snaps (`packages/examples/packages/*/snap.manifest.json`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c698209. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 5a10086 commit e5f394c

File tree

11 files changed

+36
-13
lines changed

11 files changed

+36
-13
lines changed

packages/examples/packages/dialogs/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "RT3QK/Bl2XW8O93eTzxm4kkhbWU2YLNgl0wIpQtA+Rw=",
10+
"shasum": "tPhKkcndt1BKiNffSxTpxGae+N0L8dqtbsWuMPtgwXY=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/file-upload/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "xn5ZLnAqlgmHjAQ6k8/otZ3fxZsFXtt+gW4wcGPMkRk=",
10+
"shasum": "34pGPXChz9MhZtvuhbA3mr3iJRRtf5BZuchUOppsFz8=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/home-page/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "O1/68sw9rGYH31FRWjjEs2nSWiH3uKJIE/CcWGDylCs=",
10+
"shasum": "phEuQysVh6vKuOES3NkeN22l5/YcycRVdm10adIH7b8=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/interactive-ui/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "Ov0Ar65MX7lo2uYyp3Ib4ewVnK/HenJye0xb7uTC9E8=",
10+
"shasum": "UrhDVNzx7t2w36ORy5WsywNkZQvHXcR6Sl7jPZRvG4o=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/jsx/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "2yd5MwUprX+3XNKZERiNu6IONA4kAtYIE76fEel23aQ=",
10+
"shasum": "ts/r1Ab8K2GVa0X8oqiDlmiyKlN/fLyBHS+uljXrhhM=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/preinstalled/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "JqzNl7ziMGzb/5CkbdCNzBhcagAdRVo+q7VoLlYNut8=",
10+
"shasum": "5GjC5OYTtXLw1aHztViZ2Xf1dZIgvqP4xCgw4gPT1JY=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/examples/packages/send-flow/snap.manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://github.com/MetaMask/snaps.git"
88
},
99
"source": {
10-
"shasum": "yEqB3AAMpEz6knhYbegfL699DkfGcq+akyyPmSjILSg=",
10+
"shasum": "P0uud2dk/a0PvybjWdaOPXzWlhQkUP4aHlxy8KUu4Wk=",
1111
"location": {
1212
"npm": {
1313
"filePath": "dist/bundle.js",

packages/snaps-execution-environments/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Input change events in `onUserInput` now accepts `null` values ([#3722](https://github.com/MetaMask/snaps/pull/3722))
13+
1014
## [10.2.2]
1115

1216
### Changed

packages/snaps-sdk/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Fixed
11+
12+
- Input change events in `onUserInput` now accepts `null` values ([#3722](https://github.com/MetaMask/snaps/pull/3722))
13+
1014
## [10.0.0]
1115

1216
### Changed

packages/snaps-sdk/src/types/handlers/user-input.test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,17 @@ describe('InputChangeEventStruct', () => {
6666
),
6767
).toBe(true);
6868
});
69+
70+
it('accepts null values', () => {
71+
expect(
72+
is(
73+
{
74+
type: 'InputChangeEvent',
75+
name: 'foo',
76+
value: null,
77+
},
78+
InputChangeEventStruct,
79+
),
80+
).toBe(true);
81+
});
6982
});

0 commit comments

Comments
 (0)