Skip to content

Conversation

@medz
Copy link

@medz medz commented Oct 6, 2025

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
Copy link
Author

medz commented Oct 6, 2025

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

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.

1 participant