mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fix tests
This commit is contained in:
2
src/effects.js
vendored
2
src/effects.js
vendored
@@ -181,7 +181,7 @@ export const apply_side_effects = (prev, next, ui) => {
|
||||
next.eval_modules_state != null
|
||||
) {
|
||||
const s = next.eval_modules_state
|
||||
s.promise.__original_then(result => {
|
||||
s.promise.then(result => {
|
||||
exec('eval_modules_finished',
|
||||
next, /* becomes prev_state */
|
||||
result,
|
||||
|
||||
@@ -515,7 +515,8 @@ export const eval_modules = (
|
||||
}
|
||||
|
||||
if(is_async) {
|
||||
return result.__original_then(make_result)
|
||||
// convert app_window.Promise to host Promise
|
||||
return Promise.resolve(result).then(make_result)
|
||||
} else {
|
||||
return make_result(result)
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ const make_patched_method = (window, original, name, use_context) => {
|
||||
? new original(...args)
|
||||
: original.apply(this, args)
|
||||
|
||||
if(value instanceof cxt.window.Promise) {
|
||||
if(value?.[Symbol.toStringTag] == 'Promise') {
|
||||
// TODO use __original_then, not finally which calls
|
||||
// patched 'then'?
|
||||
value = value.finally(() => {
|
||||
|
||||
@@ -262,7 +262,7 @@ const __await_start = (cxt, promise) => {
|
||||
const children_copy = cxt.children
|
||||
const result = {children_copy, promise}
|
||||
|
||||
if(promise instanceof cxt.window.Promise) {
|
||||
if(promise?.[Symbol.toStringTag] == 'Promise') {
|
||||
result.promise = promise.then(
|
||||
(value) => {
|
||||
result.status = {ok: true, value}
|
||||
|
||||
Reference in New Issue
Block a user