It would be nice to have a popup that displays pages using the query when a query is selected in the Server Actions panel. As a site grows, maintaining your queries (preventing duplication, overwriting, deletion, etc.) can become problematic.
Thatâs where having a well organized structure of meaningful folders and sub-folders comes in handy.
I was thinking of doing this. But hereâs a question⌠can I mimic my website pages under the Server Actions panel and make each page a folder (that is using a Connection and/or a query or other Actions) to display what actions are affiliated with each page? For example: âpage1â (which represents a webpage on the site) as a folder that uses query1 and âpage2â as a folder that also uses query1 and a query2, etc., etc.
Could I copy âquery1â into the âpage2â folder or would I have to re-create it?
Or am I totally missing how Wappler assigns organization to its Actions?
If you reuse the same server action on multiple pages, I see no logical reason to define the same thing mutiple times. Just define it once and reuse it as many times as needed on as many pages as needed.
Thatâs the idea behind server actions - define it once and reuse it multiple times on multiple pages.
You can definitely organize your actions that way. You canât copy actions though. Nor would I advise it. But they way you have it organized in your screenshot is a perfectly good way to go. That is basically what I have done in my screenshot. I just added sub-folders with in each page, one for forms and one for lists/queries.
You will find that good organization of your actions will save you a lot of trouble.
Yeah, Iâm seeing that already. I like what youâre doing and will organize my Action panel accordingly. This will help to prevent a late night disaster. Iâll place all my Actions in a separate folder (as I 'm already doing) and just dummy-list it if itâs being used in that pageâs folder. Thanks, Brad.
Iâd suggest a more feature oriented server action grouping method. This way you wonât have to create the same query multiple times for each page using it. A simple example:
- CMS
- Users
- List
- Insert
- Update
- Delete
- Products
- List
- Insert
- Update
- Delete
- Users
- Website
- Products
- List
- Details
- Events
- List
- Details
âŚetc.
- Products
So for example on the front end no matter on how many pages you list your products, you will always refer to a single server action: website > products > list and updating multiple pages would be easier when you have to update only one server action.
Thatâs what Iâm doing right now - wish Iâd thought about this soonerâŚ