expo-modules-jsi 56.0.9 → 56.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 56.0.10 — 2026-06-15
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [iOS] Ignore already-settled promises. ([#46765](https://github.com/expo/expo/pull/46765) by [@jakex7](https://github.com/jakex7))
|
|
18
|
+
|
|
13
19
|
## 56.0.9 — 2026-06-10
|
|
14
20
|
|
|
15
21
|
### 🎉 New features
|
|
@@ -75,15 +75,16 @@ public struct JavaScriptPromise: JavaScriptType, ~Copyable {
|
|
|
75
75
|
guard let runtime else {
|
|
76
76
|
return
|
|
77
77
|
}
|
|
78
|
-
guard !resolveFunction.isEmpty else {
|
|
79
|
-
preconditionFailure("Cannot settle a promise more than once")
|
|
80
|
-
}
|
|
81
78
|
|
|
82
79
|
// `resolve` is not isolated, so make sure to jump to JS thread.
|
|
83
80
|
runtime.schedule(priority: .immediate) { [resolveFunction, rejectFunction] in
|
|
81
|
+
// If the promise is already settled, do nothing.
|
|
82
|
+
guard let resolver = resolveFunction.take() else {
|
|
83
|
+
return
|
|
84
|
+
}
|
|
84
85
|
// Call the actual resolver given in the Promise setup.
|
|
85
86
|
// This will also call `deferredPromise.resolve` in the `then` handler.
|
|
86
|
-
_ = try!
|
|
87
|
+
_ = try! resolver.getFunction().call(arguments: value)
|
|
87
88
|
|
|
88
89
|
// Release the rejecter, we cannot call it anymore.
|
|
89
90
|
rejectFunction.release()
|
|
@@ -94,19 +95,20 @@ public struct JavaScriptPromise: JavaScriptType, ~Copyable {
|
|
|
94
95
|
guard let runtime else {
|
|
95
96
|
return
|
|
96
97
|
}
|
|
97
|
-
guard !rejectFunction.isEmpty else {
|
|
98
|
-
preconditionFailure("Cannot settle a promise more than once")
|
|
99
|
-
}
|
|
100
98
|
|
|
101
99
|
// `reject` is not isolated, so make sure to jump to JS thread.
|
|
102
100
|
runtime.schedule(priority: .immediate) { [resolveFunction, rejectFunction] in
|
|
101
|
+
// If the promise is already settled, do nothing.
|
|
102
|
+
guard let rejecter = rejectFunction.take() else {
|
|
103
|
+
return
|
|
104
|
+
}
|
|
103
105
|
// Create a JS error from any (native) error.
|
|
104
106
|
let errorMessage = String(describing: error)
|
|
105
107
|
let errorValue = JavaScriptError(runtime, message: errorMessage).asValue()
|
|
106
108
|
|
|
107
109
|
// Call the actual rejecter given in the Promise setup.
|
|
108
110
|
// This will also call `deferredPromise.reject` in the `then` handler.
|
|
109
|
-
_ = try!
|
|
111
|
+
_ = try! rejecter.getFunction().call(arguments: errorValue)
|
|
110
112
|
|
|
111
113
|
// Release the resolver, we cannot call it anymore.
|
|
112
114
|
resolveFunction.release()
|
|
@@ -279,6 +279,23 @@ struct JavaScriptPromiseTests {
|
|
|
279
279
|
#expect(result.getInt() == 99)
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
+
@Test
|
|
283
|
+
func `settling promise more than once is ignored`() async throws {
|
|
284
|
+
struct TestError: Error, Sendable {}
|
|
285
|
+
|
|
286
|
+
let runtime = JavaScriptRuntime()
|
|
287
|
+
let promise = try JavaScriptPromise(runtime)
|
|
288
|
+
|
|
289
|
+
runtime.global().setProperty("testPromise", value: promise.asValue())
|
|
290
|
+
promise.resolve(42)
|
|
291
|
+
promise.reject(TestError())
|
|
292
|
+
promise.resolve(100)
|
|
293
|
+
|
|
294
|
+
let result = try await promise.await()
|
|
295
|
+
|
|
296
|
+
#expect(result.getInt() == 42)
|
|
297
|
+
}
|
|
298
|
+
|
|
282
299
|
@Test
|
|
283
300
|
func `promise all`() async throws {
|
|
284
301
|
let runtime = JavaScriptRuntime()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-jsi",
|
|
3
|
-
"version": "56.0.
|
|
3
|
+
"version": "56.0.10",
|
|
4
4
|
"description": "The JavaScript Interface for Expo Modules",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": [],
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"./apple/scripts/test.sh"
|
|
42
42
|
]
|
|
43
43
|
},
|
|
44
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "812dc007aefed0c432c0439fdfe05ee2f4f21da2",
|
|
45
45
|
"scripts": {
|
|
46
46
|
"build": "apple/scripts/build-xcframework.sh",
|
|
47
47
|
"swift:format": "../../scripts/swift-format.sh",
|