Blog
/
Guides & Tutorials

How to: Migrate your actions to a code file design

Published
October 18, 2023
Last updated
November 7, 2023
Learn about the transition of your Gadget app actions to a new, streamlined code file design.

Hey, Gadget enthusiasts! We've got some exciting news for those who've been with us since before July 2023. As we continuously aim to improve your experience, we're introducing a new way to represent actions: a single code-based file design.

A glimpse into the migration

Curious about how this will look? Let's dive into a walkthrough example.

Re-introducing Gadget actions as code files

Previously, Gadget actions were expressed using the Effects stack: widgets in the Gadget editor that ran as Run effects or Success effects. On December 15, we're ushering in a new era with a code-file design representing each action. 

The best part? Your apps will be automatically upgraded on that date. If you're as excited about the next version of Gadget as we are, you can manually make the switch right now. Just look for the migration prompt at the top of your app's home page.

Rest assured, this change has no effect on the functionality of your app and everything will still be working as normal!

What's changing?

There are two main changes that take place when you upgrade your Gadget app:

- Each action is powered by a single code file.

- The Run and Success effect stacks are now <inline-code>run<inline-code> and <inline-code>onSuccess<inline-code> functions in this new action code file.

Post-migration, here's what you can expect:

  • A dedicated <inline-code>globalActions<inline-code> folder, featuring a JS code file for each Global action.
  • Every model folder gets an <inline-code>actions<inline-code> subfolder, housing a JS code file corresponding to each model action
  • Don't worry, your old effect file snippets are still around. They've just been incorporated into the new action code file and will be auto-imported and summoned via the run or onSuccess functions.

Post-Migration To-Dos - After the grand switch:

  • Review and Rename: Go through your Effect code snippet and Action files. Consider renaming some for clarity but remember to adjust the import statements accordingly if you decide to do so.
  • Testing: Run your app in development mode. Your production app remains untouched during this phase. But it’s important to test out and make sure nothing has changed to your app’s functionality.
  • Go Live: Once you're satisfied with the changes post-testing, all that’s left to do is deploy it!

Need help?

Migration jitters? Or perhaps a question popped up? Don't hesitate to reach out to support.

For those looking to dive deeper, check out our comprehensive guide on how the migration experience will look like.

If you have any questions or feedback surrounding the migration to a new design for your app’s actions, or want to make a request for support help in migrating, we’d love to hear from you in our Discord.

Emma Hyde
Author
Reviewer
Try Gadget
See the difference a full-stack development platform can make.
Create app
No items found.

How to: Migrate your actions to a code file design

Learn about the transition of your Gadget app actions to a new, streamlined code file design.
Problem
Solution
Result

Hey, Gadget enthusiasts! We've got some exciting news for those who've been with us since before July 2023. As we continuously aim to improve your experience, we're introducing a new way to represent actions: a single code-based file design.

A glimpse into the migration

Curious about how this will look? Let's dive into a walkthrough example.

Re-introducing Gadget actions as code files

Previously, Gadget actions were expressed using the Effects stack: widgets in the Gadget editor that ran as Run effects or Success effects. On December 15, we're ushering in a new era with a code-file design representing each action. 

The best part? Your apps will be automatically upgraded on that date. If you're as excited about the next version of Gadget as we are, you can manually make the switch right now. Just look for the migration prompt at the top of your app's home page.

Rest assured, this change has no effect on the functionality of your app and everything will still be working as normal!

What's changing?

There are two main changes that take place when you upgrade your Gadget app:

- Each action is powered by a single code file.

- The Run and Success effect stacks are now <inline-code>run<inline-code> and <inline-code>onSuccess<inline-code> functions in this new action code file.

Post-migration, here's what you can expect:

  • A dedicated <inline-code>globalActions<inline-code> folder, featuring a JS code file for each Global action.
  • Every model folder gets an <inline-code>actions<inline-code> subfolder, housing a JS code file corresponding to each model action
  • Don't worry, your old effect file snippets are still around. They've just been incorporated into the new action code file and will be auto-imported and summoned via the run or onSuccess functions.

Post-Migration To-Dos - After the grand switch:

  • Review and Rename: Go through your Effect code snippet and Action files. Consider renaming some for clarity but remember to adjust the import statements accordingly if you decide to do so.
  • Testing: Run your app in development mode. Your production app remains untouched during this phase. But it’s important to test out and make sure nothing has changed to your app’s functionality.
  • Go Live: Once you're satisfied with the changes post-testing, all that’s left to do is deploy it!

Need help?

Migration jitters? Or perhaps a question popped up? Don't hesitate to reach out to support.

For those looking to dive deeper, check out our comprehensive guide on how the migration experience will look like.

If you have any questions or feedback surrounding the migration to a new design for your app’s actions, or want to make a request for support help in migrating, we’d love to hear from you in our Discord.

Interested in learning more about Gadget?

Join leading agencies making the switch to Gadget and experience the difference a full-stack platform can make.