Hi, I just found out how to add a variable as an object on the page, which is really cool, but it would be nice if Wappler could detect the object and parse out the properties. I can bind to the variable like so:
<dmx-value id="modal_users_title" dmx-bind:value="{ "name": "Create New User" }"></dmx-value>
But the “name” property doesn’t show in the expression selector, only ‘value’. It’s a low priority issue, since I can add it manually:
Because I wanted to use the var names like variable categories to control dynamic layouts, etc. One var could have multiple properties to control a modal layout, and another var more properties for some other layout section on the same page, etc. I didn’t want 20+ variables on a page in a flat list.
I don’t need server side storage to create variables on the client side. I just wanted to use client side variables, and not have to load static server data, especially since I’m focusing on a PWA app.
Honestly it still seems a bit much. I don’t need to store anything. Local storage or session storage is more activity than I need, which is simple objects on a client. I don’t want to clutter local or session storage with dynamic scratch data. Setting an object to a variable was good enough, which I did already.
I don’t see much cost to loading stored JSON. And it allows you to use the UI.
The variable has not been designed to be used as an object, which is why it does not have a “schema” which can be used in the UI.
I am not sure how useful this will be, since JSON Data Source is already present. I personally have never seen this use case of client side objects.
If Wappler team does implement this, it would then work something like the 'SET VALUE" server action step, which allows to define what “type” of data the variable has, and allows setting a schema.
When creating Progressive Web Apps they can operate offline. I don’t want to add too much reliance on server side stuff when I don’t have to, that’s why. Besides, it’s like binding parts of a client side page to JavaScript objects, which is a common practice in normal web development in some cases.
I store objects in variables from time to time but with the expected caveat of not being able to access them via UI. Not a big nuisance tbh.
Wappler could probably add a schema detection and generation feature so they show up in the UI when you add an object but I suspect that not many people will use this.