Mini program update mechanism

Overview

The mini program update mechanism consists of the following dimensions:

Two time points

In the update mechanism, time points are very important. The mini program goes through the following time points after its first open and each update: the Async Update Time and the Sync Update Time (see the following figure):

  • The default configuration for Async Update Time is 1 hour.
  • The default configuration for Sync Update Time is 10 days.
Mini program update mechanism

First open of the mini program

When the user first opens the mini program, a loading page is displayed, and the latest version of the mini program is downloaded. (Note: This does not apply for the embedded offline package)
● If the download is successful, the loading page is closed, and the mini program page begins to render.
● If the download fails, an error page is displayed.
In the Default update mode, when the mini program is working before the Async Update Time, the mini program can be opened directly without checking for versions and updates.

Asynchronous update method

Upon launching the app, the local version is used. After a short delay, a request is made to check for a new version of the mini program:

  • If a new version is available, the mini program must be updated to the latest version. The new version is used next time when the mini program is launched.
  • If the new version fails to update, the old version is still used next time when the mini program is launched.

Regardless of whether there is a new version update, the packages already loaded into memory do not change until the app is closed. Then reload the new version. This is to prevent confusion between the caches of the new and old versions.

In the Default update mode, when the mini program is working between the Async Update Time and Sync Update Time, the asynchronous update method will be used.

Synchronous update method

Upon launching the app, a loading page is displayed and a request is made to check for a new version of the mini program.
● If the current version is already the latest version, the loading page will close and the rendering of the mini program page will begin.
● If a new version of the mini program is available, it needs to be updated to the latest version. Then the loading page will close and the rendering of the mini program page will begin.
● If the version check fails or the new version of the mini program fails to update, an error page will be displayed.

In the Default update mode, when the mini program is working after the Sync Update Time, the synchronous update method will be used.

Mini program update mode

The mini program update modes include the Default mode, Async mode, and Sync mode.

Default mode

The Default mode consists of the first open of the mini-program, asynchronous update method, and synchronous update method.

The Default mode is the default setting for the mini program upgrade mode.

Async mode

If you want the mini program to always open the local version in an offline environment, use the Async mode. In this mode, when the mini program is working after the Async Update Time, asynchronous update method will be used. Even if the mini program exceeds the Sync Update Time, it still proceeds with the asynchronous update method.

Mini program update mechanism

Sync mode

If you want the mini program of any version to update to the latest version in the future, use the Sync mode. Whenever you open the mini program under the Sync mode, the synchronous update method will be used.

Mini program update mechanism

More information

For details about how to view and edit the update mode for a specific mini program, see Manage mini program update mode.