Skip to content

Commit 37009d3

Browse files
committed
Upgrade to rescript-promise 2.1.0
1 parent 24e0057 commit 37009d3

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

package-lock.json

Lines changed: 13 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"@mdx-js/loader": "^1.5.5",
1212
"@next/mdx": "^8.1.0",
1313
"@rescript/react": "^0.10.3",
14-
"@ryyppy/rescript-promise": "^0.0.2",
14+
"@ryyppy/rescript-promise": "2.1.0",
1515
"codemirror": "^5.54.0",
1616
"docson": "^2.1.0",
1717
"fuse.js": "^6.4.3",
@@ -47,4 +47,4 @@
4747
"rescript": "9.1.2",
4848
"tailwindcss": "^1.6.0"
4949
}
50-
}
50+
}

src/common/CompilerManagerHook.res

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ let attachCompilerAndLibraries = (~version: string, ~libraries: array<string>, (
102102
/* let compilerUrl = "/static/linked-bs-bundle.js"; */
103103

104104
LoadScript.loadScriptPromise(compilerUrl)
105-
->Promise.map(r => {
105+
->Promise.thenResolve(r => {
106106
switch r {
107107
| Error(_) => Error(j`Could not load compiler from url $compilerUrl`)
108108
| _ => r
@@ -113,7 +113,7 @@ let attachCompilerAndLibraries = (~version: string, ~libraries: array<string>, (
113113
| Ok() =>
114114
Belt.Array.map(libraries, lib => {
115115
let cmijUrl = CdnMeta.getLibraryCmijUrl(version, lib)
116-
LoadScript.loadScriptPromise(cmijUrl)->Promise.map(r =>
116+
LoadScript.loadScriptPromise(cmijUrl)->Promise.thenResolve(r =>
117117
switch r {
118118
| Error(_) => Error(j`Could not load cmij from url $cmijUrl`)
119119
| _ => r
@@ -125,7 +125,7 @@ let attachCompilerAndLibraries = (~version: string, ~libraries: array<string>, (
125125

126126
Promise.all(promises)
127127
})
128-
->Promise.map(all => {
128+
->Promise.thenResolve(all => {
129129
let errors = Belt.Array.keepMap(all, r => {
130130
switch r {
131131
| Error(msg) => Some(msg)
@@ -333,7 +333,7 @@ let useCompilerManager = (~initialLang: Lang.t=Res, ~onAction: option<action =>
333333
let libraries = ["@rescript/react"]
334334

335335
attachCompilerAndLibraries(~version=latest, ~libraries, ())
336-
->Promise.map(result =>
336+
->Promise.thenResolve(result =>
337337
switch result {
338338
| Ok() =>
339339
let instance = Compiler.make()
@@ -375,7 +375,7 @@ let useCompilerManager = (~initialLang: Lang.t=Res, ~onAction: option<action =>
375375
let migratedLibraries = libraries->migrateLibraries(~version)
376376

377377
attachCompilerAndLibraries(~version, ~libraries=migratedLibraries, ())
378-
->Promise.map(result =>
378+
->Promise.thenResolve(result =>
379379
switch result {
380380
| Ok() =>
381381
// Make sure to remove the previous script from the DOM as well

0 commit comments

Comments
 (0)