Nanoflow in native app crashes

0
Hi,In my native app I have a page with a nanoflow datasource and in that nanoflow I create a non persistent enity (NPE) as a helper object to be able to toggle the bottomsheet. On that page, there is a button with another nanoflow that uses that NPE as an input parameter, change that object (toggle a boolean value of that object) and return the NPE back as an output parameter.This is working fine in mendix 10.24.14 but not anymore in 11.6.3, the app crashes in MakeItNative without any errors.Any ideas what could be the reason?
asked
3 answers
0

hi,



This breaks in Mendix 11 because of a client/runtime change in how nanoflow datasources handle NPEs.

In Mendix 10, returning and reusing the same non-persistent object instance from a nanoflow datasource and then mutating it in another nanoflow happened to work.

In Mendix 11, the client has become much stricter about immutability and object lifecycle — especially in Native / MakeItNative.

What’s happening now:

  • The nanoflow datasource creates an NPE
  • The page treats that object as read-only datasource state
  • When another nanoflow tries to change that same NPE instance and return it, the native client ends up in an invalid state
  • Result: MakeItNative crashes silently (known pattern, no console error)

This is not a MakeItNative bug — it’s an unsupported pattern that no longer works in Mendix 11.

Why it worked before

Mendix 10’s client was more permissive and allowed mutating datasource objects. Mendix 11 tightened this for stability and consistency across web/native.

Correct pattern going forward (works in 11)

Do not mutate and return the same NPE coming from a nanoflow datasource.

Instead, use one of these supported approaches:

  • Store the toggle state in a page variable
  • Or recreate a new NPE instance inside the action nanoflow and return that
  • Or manage the toggle state via nanoflow variable / page parameter, not the datasource object


answered
0

Mendix documentation explicitly states:

“Non-persistent objects are stored in memory only and can be removed by the runtime when they are no longer referenced.”

(https://docs.mendix.com/refguide/transient-objects-garbage-collecting/)


This means NPEs exist only in memory and their lifecycle is not guaranteed. They may be garbage-collected when references are lost, so relying on them as durable UI state across nanoflow calls. Especially in Native apps can cause unstable behavior or crashes.


Safer approach: keep the helper as the page context, only toggle the boolean on the same object, and trigger a refresh in client (don’t rely on returning the NPE).


answered
0

Responsive

Responsive


Native

answered