mirror of
https://github.com/leporello-js/leporello-js
synced 2026-01-13 13:04:30 -08:00
fix refactor value explorer
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
|
||||
import {el, stringify, scrollIntoViewIfNeeded} from './domutils.js'
|
||||
import {with_code_execution} from '../index.js'
|
||||
import {header, is_expandable} from '../value_explorer_utils.js'
|
||||
import {header, is_expandable, displayed_entries} from '../value_explorer_utils.js'
|
||||
|
||||
|
||||
const get_path = (o, path) => {
|
||||
@@ -236,7 +236,13 @@ export class ValueExplorer {
|
||||
this.set_active(this.current_path, true)
|
||||
}
|
||||
|
||||
render_value_explorer_node(key, value, path, node_data) {
|
||||
render_value_explorer_node(...args) {
|
||||
return with_code_execution(() => {
|
||||
return this.do_render_value_explorer_node(...args)
|
||||
})
|
||||
}
|
||||
|
||||
do_render_value_explorer_node(key, value, path, node_data) {
|
||||
|
||||
const is_exp = is_expandable(value)
|
||||
const is_expanded = is_exp && node_data.is_expanded
|
||||
|
||||
@@ -291,6 +291,8 @@ export const exec = (cmd, ...args) => {
|
||||
}
|
||||
|
||||
|
||||
// Wrap with_code_execution, because rendering values can trigger execution
|
||||
// of code by toString() and toJSON() methods
|
||||
with_code_execution(() => {
|
||||
apply_side_effects(state, nextstate, cmd, ui);
|
||||
|
||||
|
||||
@@ -22,15 +22,13 @@ const isDate = object =>
|
||||
|
||||
const toJSON_safe = object => {
|
||||
try {
|
||||
return with_code_execution(() => {
|
||||
return object.toJSON()
|
||||
})
|
||||
return object.toJSON()
|
||||
} catch(e) {
|
||||
return object
|
||||
}
|
||||
}
|
||||
|
||||
const displayed_entries = object => {
|
||||
export const displayed_entries = object => {
|
||||
if(object == null || typeof(object) != 'object') {
|
||||
return []
|
||||
} else if((object[Symbol.toStringTag]) == 'Module') {
|
||||
|
||||
Reference in New Issue
Block a user