# Creating/reading runtime objects when offline

**URL:** https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760
**Category:** Ask the community
**Created:** [October 9, 2023, 7:21am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760 "2023-10-09T07:21:56Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Ryan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/ryan/32/1279_2.png) [@Ryan](https://community.appfarm.io/u/Ryan)
#### Post date: [October 9, 2023, 7:21am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/1 "2023-10-09T07:21:57Z")

</div>

Hi!

I’m trying to design an app for offline data handling. I have tried following the documentation, but the issue I’m running into now is that these two actions both trigger a ConnectionNotReady error:

- Reading from one runtime data source (single cardinality) to another (multi-cardinality)
- Creating in a multi-cardinality runtime data source

It seems the only option then is to only allow the user to create one object while offline? Would it be possible to enable several objects created offline, only to persist once online?

---

<div class="post-metadata">

### Author: ![Olav](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/olav/32/63_2.png) [@Olav](https://community.appfarm.io/u/Olav)
#### Post date: [October 10, 2023, 10:23am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/2 "2023-10-10T10:23:59Z")

</div>

There should be no issues using multi-cardinality data sources offline. Can you check that you have no generated data sources using the command `appfarmDebug.toggleGeneratedDataInDevTools()` in the console? This is usually what triggers ConnectionNotReady errors.  
If the case is that you have generated data sources, you can get rid of these by setting up reference data sources for the data sources that trigger the errors.

---

<div class="post-metadata">

### Author: ![Ryan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/ryan/32/1279_2.png) [@Ryan](https://community.appfarm.io/u/Ryan)
#### Post date: [October 10, 2023, 12:06pm UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/3 "2023-10-10T12:06:09Z")

</div>

> [@Olav](#):
>
> appfarmDebug.toggleGeneratedDataInDevTools()

Thanks for the response! After adding the reference data sources as you suggested, the generated data sources seem to still be persisting in our database even after refreshing, thereby triggering the same error. Is there a way to delete these generated data sources?

---

<div class="post-metadata">

### Author: ![Olav](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/olav/32/63_2.png) [@Olav](https://community.appfarm.io/u/Olav)
#### Post date: [October 10, 2023, 12:22pm UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/4 "2023-10-10T12:22:32Z")

</div>

We do quite a lot of caching on the client, so that might be why the generated data sources are not disappearing. A hacky solution to this is to add a new runtime property on a data source, use it in the UI and then change its nodename. That forces Create to load the whole model anew and parse everything.  
Hope that helps!

---

<div class="post-metadata">

### Author: ![Ryan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/ryan/32/1279_2.png) [@Ryan](https://community.appfarm.io/u/Ryan)
#### Post date: [October 13, 2023, 7:41am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/5 "2023-10-13T07:41:34Z")

</div>

> [@Olav](#):
>
> appfarmDebug.toggleGeneratedDataInDevTools()

Hello again! Are there any other possible reasons for a ConnectionNotReady error? I am getting this same error now even though I do not have any generated data sources.

---

<div class="post-metadata">

### Author: ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)
#### Post date: [October 13, 2023, 11:40am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/6 "2023-10-13T11:40:24Z")

</div>

Hi!

Do you have the same action connected to both “On App Load” and “On Online” event handlers in App Settings? I believe I got that ConnectionNotReady error when I had the same action on both these events. An Offline app only need an “On Online”, since that event is triggered on app refresh (when online).

---

<div class="post-metadata">

### Author: ![Ryan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/ryan/32/1279_2.png) [@Ryan](https://community.appfarm.io/u/Ryan)
#### Post date: [October 16, 2023, 7:21am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/7 "2023-10-16T07:21:32Z")

</div>

Hi!

I don’t actually. I only have one action which is connected to “On Online”, as suggested in the documentation…

If it helps, the error is triggered by an action reading from a single cardinality data source to a multi-cardinality data source, where I am trying to add to the existing data.

---

<div class="post-metadata">

### Author: ![kristian](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/kristian/32/58_2.png) [@kristian](https://community.appfarm.io/u/kristian)
#### Post date: [October 16, 2023, 8:00am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/8 "2023-10-16T08:00:58Z")

</div>

Hi!

First off: Could you try a hard refresh of that app in the client, and also try another browser just to remove any caching issues.

Then: If you reading from a single cardinality datasource into a “many” data source: How does the single cardinality get it’s objects? From another read objects?

I just set up for following case:

1. Read all “Tasks” on online into “Tasks (all)” runtime only datasource
2. An action that loops “Tasks (all)” and reads into a single cardinality “Task” datasource, and then reads the single “Task” into a third data source “Tasks (add to)” (cardinality many).

If somewhere in your App you try to reference Task.Project.Title, or Tasks (add to).Project.Title, I get the connectionNotReady error. But also, I get secondardy data sources. It makes sense, since when the read of data in 1) is performed, there is no references in the App using “Tasks (all).Project.Title”, so these data are not read. So when these other data sources use the “project.title” reference, Appfarm tries to read these (secondary data) upon the “read from”.

If, however, you also make sure that “Tasks (all).Project.Title” is in use in the App, then these data are alread read “on online” and you get no such secondary data sources, and no connectionNotReady error.

Hope that might help you in right direction.

---

<div class="post-metadata">

### Author: ![Ryan](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/ryan/32/1279_2.png) [@Ryan](https://community.appfarm.io/u/Ryan)
#### Post date: [October 19, 2023, 8:42am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/9 "2023-10-19T08:42:05Z")

</div>

> [@Olav](#):
>
> appfarmDebug.toggleGeneratedDataInDevTools()

Hi Kristian, I have tried hard refreshing, using another browser and have checked that Reference Data Sources are used where deep data bindings are used.

However, I am still getting the same error message.

It seems strange that I don’t have any generated data sources even though I am getting this error?

---

<div class="post-metadata">

### Author: ![jeremy.jean](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/jeremy.jean/32/123_2.png) [@jeremy.jean](https://community.appfarm.io/u/jeremy.jean)
#### Post date: [November 17, 2023, 2:12pm UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/10 "2023-11-17T14:12:12Z")

</div>

Hello,  
I had this same issue (error ConnectionNotReady) while testing the offline mode.  
I figured out that it was due to the “Created by” flag on my object class.  
By removing it, it’s now working fine.  
I don’t know if this could be related ?

---

<div class="post-metadata">

### Author: ![Yassine.tebib](https://dub1.discourse-cdn.com/flex013/user_avatar/community.appfarm.io/yassine.tebib/32/74_2.png) [@Yassine.tebib](https://community.appfarm.io/u/Yassine.tebib)
#### Post date: [March 20, 2025, 9:34am UTC](https://community.appfarm.io/t/creating-reading-runtime-objects-when-offline/760/11 "2025-03-20T09:34:07Z")

</div>

Hey

Found it , it was one Reference missing

thanks again 😃
