Contact Us

Backbone.js, the framework underlying SuiteCommerce’s frontend logic. Backbonej.js defaults to asynchronous saves, which is a behavior that generally keeps the UI responsive. However, there are cases (such as multi-step data updates or sequential dependencies) where you need to ensure a model is fully saved before executing the next step. Here, I will explore how to override that default behavior and force a synchronous save.

Note: I do not recommend saving models synchronously unless you have to. It is rare for this to be a best practice solution.

Documentation for Backbone model.save() function: Backbone.js

Code to Force a Backbone Model to "Save" Synchronously

The Backbone “save” function on Models runs asynchronously by default. There may be times when you want this call to run synchronously. See the code block below for the required parameter in that case.

let model = new Backbone.Model(); model.save({ test: "test"}, { async: false }); model.get('test') // this equals test and will not run until the save is complete

NOTE: “async” MUST be passed in the second argument for it to be read as an argument of the function rather than an attribute on the model.

When to Use Synchronous Saves

  • Dependent workflows: e.g., create, then immediately fetch related data.

  • Sequential UI updates: e.g., increment counters only after save confirmation.

  • Caution: Browsers may warn about synchronous requests blocking the UI.

While Backbone’s default async save behavior is good for most scenarios, by setting async: false, you gain control. However, you must balance it against potential UI blockage and performance effects.

FREE SuiteCommerce Book

If you liked this article, you'll LOVE our book on SuiteCommerce! Order the free SuiteCommerce book today, and we'll even pay for shipping!

Anchor Group NetSuite Ecommerce SuiteCommerce Book

Oracle NetSuite Alliance Partner & Commerce Partner

If you have general questions about SuiteCommerce or more specific questions about how our team can support your business as you implement NetSuite or SuiteCommerce, feel free to contact us anytime. Anchor Group is a certified Oracle NetSuite Alliance Partner and Commerce Partner equipped to handle all kinds of NetSuite and SuiteCommerce projects, large or small!

Horizontal Anchor Group logo orange anchor icon navy Anchor Group text

We are a premium SuiteCommerce agency that creates powerful customer portals. Unlike our competitors, we have already solved your problems.

Tagged with Training