nank1ro / solidart

Signals in Dart and Flutter, inspired by SolidJS
https://docs.page/nank1ro/solidart
MIT License
155 stars 5 forks source link

A few questions regarding your library #19

Closed jacob-emery closed 1 year ago

jacob-emery commented 1 year ago
  1. In the docs it is stated that "You may incur the need to pass a Signal deep into the tree, this is discouraged. You should never pass a signal as a parameter.". Is this recommended only to prevent having a huge number of params as the app grows? Or does it have something to do with functionality too.

  2. I have used Riverpod, but I want to move away from it because of many reasons (global nature of providers, ref is needed everywhere, ...). Some questions on how to move from Riverpod (I never used solidJS, so some questions might sound a bit silly 😂).

    • 2.1. What do you use internally? ChangeNotifier (and/or ValueNotifiers)? Or some custom class extending ChangeNotifier? Or StateNotifier?
    • 2.2. Riverpod providers are only lazy. What about solidart signals, resources, and so on? Are they strict by default, lazy by default, only strict or only lazy?
    • 2.3. What is the analogous of Effect, in Riverpod?
    • 2.4. In Riverpod I usually create my own notifiers to manage custom logic (something more advance than just changing state of a signal). What is the equivalent in your lib? It is my understanding, that when working with signals readers don't have direct access to the notifiers. How would you achieve functionality that is similar to the TodoNotifier in this example https://riverpod.dev/docs/providers/state_notifier_provider?
  3. Are memos supported (yet)? Or are there just the same as derived signals in your lib?

  4. If I were to only use Soliddart throughout my app, is reactivity really like in SolidJS (i.e. rebuilds only when really needed)?

  5. Is the Solid widget needed only for inheriting a value, e.g.:

    final themeMode = context.observe<ThemeMode>(SignalId.themeMode);

    Or is a root Solid widget necessary when using this library in general, i.e., also before calling e.g.:

    SignalBuilder(
      signal: counter,
      builder: (_, value, __) {
        return Text('$value');
      },
    )

Maybe it would make sense to create a Discussion section and move this issue there.