@graineai/inapp-react-native 0.26.1 → 0.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/INTEGRATION.md CHANGED
@@ -819,9 +819,12 @@ fourth. The guarantees, so you do not have to think about them:
819
819
  applies only to the SDK's own text socket, never to a host's channel.
820
820
  - **Ordered.** Every context frame carries a monotonic `seq`; the runtime keeps
821
821
  the newest and drops anything that arrives late. The last screen always wins.
822
- - **Cleanup-safe.** A screen's unmount clears the screen only if it is still
823
- the one being described (`client.clearScreen(id)`), so a navigation library
824
- unmounting the old screen after the new one mounted cannot erase it.
822
+ - **Cleanup-safe.** The description is re-sent whenever its state changes and
823
+ withdrawn only on unmount — never on a change (0.26.2; earlier versions sent
824
+ a screen-less frame before every navigation). The withdrawal clears the
825
+ screen only if it is still the one being described (`client.clearScreen(id)`),
826
+ so a navigation library unmounting the old screen after the new one mounted
827
+ cannot erase it.
825
828
  - **Reconnect-safe.** The newest context is replayed whenever the media or the
826
829
  screen channel (re)connects.
827
830
  - **Self-healing.** The newest screen is re-asserted every few seconds during
@@ -346,8 +346,12 @@ export function useGraineScreen(context) {
346
346
  const serialised = JSON.stringify(context ?? null);
347
347
  useEffect(() => {
348
348
  client.setScreen(context);
349
- return () => client.clearScreen(context?.screen);
350
349
  }, [client, serialised]);
350
+ const reported = useRef(context?.screen);
351
+ reported.current = context?.screen;
352
+ useEffect(() => () => {
353
+ client.clearScreen(reported.current);
354
+ }, [client]);
351
355
  }
352
356
  export function useGraineField(name, field) {
353
357
  const client = useGraineClient();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graineai/inapp-react-native",
3
- "version": "0.26.1",
3
+ "version": "0.26.2",
4
4
  "type": "module",
5
5
  "description": "Graine in-app agent for React Native — an agent that sees the screen your customer is on and can act on it.",
6
6
  "license": "MIT",