Skip to content

Babel Plugin - Memo does not work with multiple children #620

@chrisstpierre

Description

@chrisstpierre

Version: 3.0.0-beta.42
Platform: React Native / Expo@^54.0.23

Based on the documentation I would expect these (with the babel plugin) to be identical:

// This works as expected. The name is rendered twice
<Memo>
	{() => (
		<>
			<Text>{state$.computedObservable.get()?.name ?? "loading"}</Text>
			<Text>{state$.computedObservable.get()?.name ?? "loading"}</Text>
		</>
	)}
</Memo>

// This doesn't work. It shows loading and does not update when the observable changes.
<Memo>
		<Text>{state$.computedObservable.get()?.name ?? "loading"}</Text>
		<Text>{state$.computedObservable.get()?.name ?? "loading"}</Text>
</Memo>

The babel plugin does appear to be working. This works:

<Memo>
		<Text>{state$.computedObservable.get()?.name ?? "loading"}</Text>
</Memo>

But when there is more than one child the computed observable no longer triggers re-renders.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions