Closed realitix closed 4 years ago
After more digging, here the json code in error:
{
"$jason": {
"head": {
"title": "Recettes",
"templates": {
"header": {
"title": "Mes recettes",
"style": {
"background": "#646464",
"color": "#ffffff"
}
},
"body": {
"style": {
"border": "none",
"background": "#636363"
},
"header": {
"title": "Mes recettes"
},
"footer": {
"tabs": {
"items": [
{
"text": "Planning",
"url": "file://out/planning.json"
},
{
"text": "Recettes",
"url": "file://out/receipe.json"
},
{
"text": "D\u00e9connexion",
"url": "file://out/disconnect.json"
}
]
}
},
"sections": [
{
"items": [
{
"type": "button",
"text": "Cr\u00e9er une nouvelle recettes",
"action": {
"type": "$util.alert",
"options": {
"title": "Cr\u00e9ation d'une recette",
"description": "Indiquez le nom de la recette \u00e0 cr\u00e9er",
"form": [
{
"name": "receipe_name",
"placeholder": "Nom de la recette"
}
]
},
"success": {
"type": "$network.request",
"options": {
"url": "https://abouletonfilm.fr/receipes/",
"method": "post",
"content_type": "json",
"data": {
"name": "{{$jason.receipe_name}}"
}
},
"success": {
"type": "$util.alert",
"options": {
"title": "toto",
"description": "{{$root}}"
}
}
}
}
}
]
},
{
"items": {
"{{$each $jason.results}}": {
"type": "label",
"text": "{{name}}"
}
}
}
]
}
},
"actions": {
"$load": {
"type": "$network.request",
"options": {
"url": "https://abouletonfilm.fr/receipes/"
},
"success": {
"type": "$render"
}
}
}
}
}
}
Ok I found out.
The problem is in my Json file. I set two times the key item in section...
Finally I encouneter the problem again. The problem was not my json but the json parser:
W/JasonParser: _executeStringFunction : undefined:211: RangeError: Maximum call stack size exceeded
str = str.replace(re, '$1');
^
RangeError: Maximum call stack size exceeded
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at Object.tokenize (<anonymous>:211:17)
at Object.run (<anonymous>:455:31)
at Object.run (<anonymous>:479:36)
at Object.run (<anonymous>:479:36)
at Object.run (<anonymous>:479:36)
at Object.run (<anonymous>:479:36)
at Object.run (<anonymous>:479:36)
at Object.run (<anonymous>:479:36)
com.eclipsesource.v8.V8ScriptExecutionException
Here the json that create the error:
{
"$jason": {
"head": {
"title": "Recettes",
"templates": {
"header": {
"title": "Ajout d'un repas",
"style": {
"background": "#646464",
"color": "#ffffff"
}
},
"body": {
"style": {
"border": "none",
"background": "#FFFFFF"
},
"header": {
"title": "Ajout d'un repas"
},
"footer": {
"tabs": {
"items": [
{
"text": "Planning",
"url": "file://out/planning.json"
},
{
"text": "Recettes",
"url": "file://out/receipes_list.json"
},
{
"text": "D\u00e9connexion",
"url": "file://out/disconnect.json"
}
]
}
},
"sections": [
{
"items": [
{
"type": "label",
"text": "{{$get.selected_datetime}}",
"action": {
"type": "$util.datepicker",
"options": {
"date_format": "yyyy-MM-ddTHH:mm",
"title": "S\u00e9lectionner la date",
"description": "Date \u00e0 s\u00e9lectionner",
"ampm": false
},
"success": {
"type": "$set",
"options": {
"selected_datetime": "{{$jason.value}}"
},
"success": {
"type": "$log.debug",
"options": {
"text": "{{$root}}"
}
}
}
}
},
{
"type": "button",
"text": "Valider",
"action": {
"type": "$network.request",
"options": {
"url": "http://127.0.0.1:18385/meals/",
"method": "post",
"data_type": "json",
"content_type": "json",
"data": {
"datetime": "{{$get.selected_datetime}}",
"nb_people": 1
}
},
"success": {
"type": "$href",
"options": {
"url": "file://out/planning_meal.json",
"options": {
"meal_url": "{{$jason.url}}"
}
}
},
"error": {
"type": "$util.alert",
"options": {
"title": "Erreur",
"description": "Une erreur est survenue"
}
}
}
}
]
}
]
}
},
"actions": {
"$load": {
"type": "$render"
}
}
}
}
}
I noticed something. If I change $root
by test
in the log.debug
action, the error disappears. So I don't know what st.js do when it reads $root
but it seems it did a lot.
Thanks @realitix. This is something that could be handled in the next release. Maybe doing some test for large jsons. Also the $root
thing may need futher investigation.
Describe the bug My view was sometime blank on Android. After deep searching, I figured out that the cause was this error:
After digging, it seems that the problem comes form this line HERE.
To Reproduce I am using this json with lot of linked actions (and that may be the problem because too much recursion):
Smartphone (please complete the following information):