When I first started using Wappler, I hadn’t spotted the App ID field on every page. Then, when I did spot it, I assumed it should be unique on every page like IDs are on elements. Then I got more familiar with the way Wappler works and realised the App ID should be consistent across all pages in a project.
But, I’m not sure I’m right! And I’m trying to set a cookie from within an included file and the mix of App IDs seems to be causing the cookie to not appear in the dropdown.
I have a project which has a number of pages set with the same App ID but some other pages set to other IDs. Also, none of them have an ID that’s actually relevant to the app itself. Some have it as ‘index’, some named after one of the pages, etc.
Am I going to break things if I change the IDs? What’s the best structure to work with? What’s the best way to rectify my little mess?!
You should really use the App ID - as the name implies - to give your app or collection of pages making your app/site - an unique ID.
So mostly you will use the same name, except if you have a complete set of pages with totally different functionality. Like having an admin part, a client area etc.
So just try to give the related pages, grouped together by functionality - an unique ID.
What’s the approach to fix a mass of different IDs? I know that the /dmxAppConnect/config.js is structured around the IDs so don’t want to break everything.
If you have a main APP ID setup already you can just go the any sub pages and enter the same APP ID there as well. It will be used from now on there as well.
There is no a specific "main ID" term - just get the one you are using on these "number of pages" you mention and add it to your other pages, where you need it.
For me, the main function/benefit of setting an App id is that any query parameters defined for an App id are present for any other page with that same id. Saves having to re-define them on each page
Yes, I now realise that but didn’t appreciate it earlier in the project build. So I want to make them consistent but fear I’ll break things if I just change them all. Big changes happen in the config.js file which I don’t understand the impacts of.
If that’s the case then that’s good. But I noticed the config.js file puts the cookie details in a section named after the App ID which is what steered me in this direction.
Changing the App ID will not break your app. The id is only used within Wappler to store metadata belonging to the specific app, having the same App ID will share that metadata. This is only for several global components, like the query parameters, state manager etc.
Thanks @patrick. So the config.js file will be updated accordingly and everything will continue to work fine? When I tried this yesterday, the changes seemed quite extreme (I used the Git show changes feature) and it made me nervous.
I’ve gone for it and changed the App ID on all pages and it’s all working fine and it’s also fixed the issue I had of the cookies not appearing in the list. Happy days. My hunch was right