> For the complete documentation index, see [llms.txt](https://docs.jigx.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jigx.com/building-apps-with-jigx/data/when-to-load-data.md).

# When to load data

### Sync data when the solution loads or gets focus

**Benefits:**

* The app is robust for offline scenarios.
* Jig rendering and interaction are very fast.
* There are only 2 distinct cloud interaction cycles in the example below: once when all data is synced and once when an update is sent to the cloud.

This is the recommended pattern when designing a Jigx solution.

**Drawbacks:**

* Initial app load time is slightly longer and heavier.
* Doesn’t work for all scenarios where the app depends on up-to-date data from the cloud when a jig is displayed.

<figure><img src="https://1245694154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F974dgqxfbgR9q4tCkGgb%2Fuploads%2FkT5Lz68ey1db4KByi4bq%2Fdata-solutionSync.png?alt=media&amp;token=0fc222ba-68aa-4b12-aaff-8c8b1e18defb" alt="Solution data sync"><figcaption><p>Solution data sync</p></figcaption></figure>

### Sync just in time when a jig is used

**Benefits:**

* Initial load is lighter.
* Only the data needed per screen is synced to the device.

Elements of this approach can be combined with the recommended approach above.

**Drawbacks:**

* The solution cannot robustly go offline.
* The data might not be available for the jig when the app is offline.
* The user might experience a slower performance of jigs because of just-in-time cloud operations.
* There are 9 (8 reads and one update) cloud operations throughout the UI cycles at 5 different distinct stages.

<figure><img src="https://1245694154-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F974dgqxfbgR9q4tCkGgb%2Fuploads%2FaX40jBpnP40vwhZKrcrU%2Fdata-solutionJigSync.png?alt=media&amp;token=b13954f9-8c95-4de9-b461-dae9f331e309" alt="Sync data just in time"><figcaption><p>Sync data just in time</p></figcaption></figure>

### Dynamically syncing data

When building a solution, the number of entities to sync and the parameters for each are not always known; for example, when syncing the attachments for a message, there can be zero, one or more attachments, or files/documents stored in a OneDrive directory. It is necessary to dynamically specify a list of the entities and function+parameters to return from the database using an expression. See [Dynamically sync multiple entities](https://docs.jigx.com/examples/readme/actions/sync-entities#dynamically-sync-multiple-entities) for more information.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.jigx.com/building-apps-with-jigx/data/when-to-load-data.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
