Closed nank1ro closed 5 months ago
Note that SignalBuilder
has a hidden footgun that will catch some users. Any signals accessed in its entire subtree will trigger a rebuild in the parent.
SignalBuilder
|_ Container
|_ Column
|_ SizedBox
|_ SignalBuilder
|_ Text <- signal watched here will rebuild both SignalBuilders
Note that
SignalBuilder
has a hidden footgun that will catch some users. Any signals accessed in its entire subtree will trigger a rebuild in the parent.SignalBuilder |_ Container |_ Column |_ SizedBox |_ SignalBuilder |_ Text <- signal watched here will rebuild both SignalBuilders
Thanks for reporting 🙏, need to investigate further to fix this
@jinyus can't reproduce the issue, this is the code I used to test
import 'package:flutter/material.dart';
import 'package:flutter_solidart/flutter_solidart.dart';
final a = Signal(0);
final b = Signal(100);
class TestPage extends StatelessWidget {
const TestPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SignalBuilder(
builder: (_, __) {
print('build a');
return Column(
children: [
Text(a().toString()),
const Second(),
],
);
},
),
floatingActionButton: Column(
mainAxisSize: MainAxisSize.min,
children: [
TextButton(
onPressed: () => a.value++,
child: const Text('add to A'),
),
TextButton(
onPressed: () => b.value++,
child: const Text('add to B'),
),
],
),
);
}
}
class Second extends StatelessWidget {
const Second({super.key});
@override
Widget build(BuildContext context) {
return SignalBuilder(
builder: (_, __) {
print('build b');
return Text(b().toString());
},
);
}
}
Can you share your code please?
I'm no longer seeing this bug. I will have to investigate further. Consider this a non-issue for now.
All modified and coverable lines are covered by tests :white_check_mark:
Please upload report for BASE (
dev@e3bd529
). Learn more about missing BASE report.
CHORE: Improved
Solid
widget performance by more than 3000% in finding ancestor providers. During my performance tests, before I was able to observe up to71
signals (provided through Solid) per second, now this numbers increased to2159
signals per second.FEAT: The
SignalBuilder
widget now automatically tracks theSignal
s used in thebuilder
function allowing you to react to any number of signals at the same time. Before:Now:
BREAKING CHANGE: Removed
DualSignalBuilder
andTripleSignalBuilder
in favor ofSignalBuilder
.BREAKING CHANGE the
context.observe
methods (due to the performance improvements of theSolid
widget) now needs the type of signal Before:Now:
BREAKING CHANGE: Removed
ResourceBuilder
in favor ofSignalBuilder
FEAT: Add
batch
function to execute a callback that will not side-effect until its top-most batch is completed. See docs hereThe PR has still some problems:
TODOs