I was wondering why my frontend page kept being empty (index.html loaded but without data). As I did a lot of infrastructure changes I ignored it first.
Yesterday, I started digging and found the reason to be unescaped characters in pethubconfig.json. To be precise:
"Custom_Modes": "['Threeseconds', 'Metalmode2', 'Extendedrange']"
The loading function for the config sits in
|
return web.Response(content_type='application/javascript', body='pethubconfig=JSON.parse(\'' + json.dumps(request.app['pethubconfig']) + '\');') |
and this then obviously results in a
Uncaught SyntaxError missing ( after argument list
A fix is to remove the JSON.parse entirely as you read JSON into JS which does not require any additional parsing:
return web.Response(content_type='application/javascript', body='pethubconfig=' + json.dumps(request.app['pethubconfig']))
This populates the frontend again without any errors.
I was wondering why my frontend page kept being empty (index.html loaded but without data). As I did a lot of infrastructure changes I ignored it first.
Yesterday, I started digging and found the reason to be unescaped characters in pethubconfig.json. To be precise:
"Custom_Modes": "['Threeseconds', 'Metalmode2', 'Extendedrange']"The loading function for the config sits in
pethublocal/pethublocal/frontend.py
Line 194 in d3fc739
and this then obviously results in a
Uncaught SyntaxError missing ( after argument listA fix is to remove the JSON.parse entirely as you read JSON into JS which does not require any additional parsing:
return web.Response(content_type='application/javascript', body='pethubconfig=' + json.dumps(request.app['pethubconfig']))This populates the frontend again without any errors.