Skip to content

Add Oref-like composition API package#413

Open
medz wants to merge 2 commits into
rodydavis:mainfrom
medz:feat/compose
Open

Add Oref-like composition API package#413
medz wants to merge 2 commits into
rodydavis:mainfrom
medz:feat/compose

Conversation

@medz

@medz medz commented Oct 6, 2025

Copy link
Copy Markdown

I'm currently having issues with how I handle the effect flags, so it won't trigger the Widget rebuild correctly.

CC @rodydavis

class Counter extends StatelessWidget {
  const Counter({super.key});

  @override
  Widget build(BuildContext context) {
    final count = signal(context, 0);

    return Scaffold(
      appBar: AppBar(title: const Text('Counter')),
      body: Center(child: Text('Count: ${count.value}')),
      floatingActionButton: FloatingActionButton(
        onPressed: () => count.value++,
        tooltip: 'Increment',
        child: const Icon(Icons.plus_one),
      ),
    );
  }
}

@medz

medz commented Oct 6, 2025

Copy link
Copy Markdown
Author

The evalContext in preact_signals isn't collected correctly as I'd expected simply by setting it.

Instead, it doesn't have direct collection capabilities. Ideally, the flow is:

  1. .value -> track effect (set evalContext)
  2. value changed -> trigger effect
  3. rebuild -> goto at 1

@rodydavis

Copy link
Copy Markdown
Owner

Thank you for the PR!

Once thing I am tracking is the upstream changes with preact_signals and it makes it possible to keep the expected behavior the same as they make changes.

If someone has a bug in the dart version it should be able to be recreated on the JS version.

That being said, if it doesn't impact expected behavior I am happy to add it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants