Skip to content

Commit

Permalink
refactor: change link returns void
Browse files Browse the repository at this point in the history
  • Loading branch information
medz committed Jan 7, 2025
1 parent 4867b63 commit 59817b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions lib/src/system.dart
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,18 @@ void _drainQueuedEffects() {
}

/// Create or reuse a link between a dependency and subscriber
Link link(Dependency dep, Subscriber sub) {
void link(Dependency dep, Subscriber sub) {
final currentDep = sub.depsTail;
final nextDep = currentDep != null ? currentDep.nextDep : sub.deps;

if (nextDep != null && nextDep.dep == dep) {
sub.depsTail = nextDep;
return nextDep;
} else {
_linkNewDep(dep, sub, nextDep, currentDep);
}

return _linkNewDep(dep, sub, nextDep, currentDep);
}

Link _linkNewDep(
void _linkNewDep(
Dependency dep,
Subscriber sub,
Link? nextDep,
Expand Down Expand Up @@ -215,8 +214,6 @@ Link _linkNewDep(

sub.depsTail = newLink;
dep.subsTail = newLink;

return newLink;
}

/// Propagate changes through the dependency graph
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: alien_signals
description: The lightest signal library - Dart implementation of alien-signals.
version: 0.0.14
version: 0.0.15
repository: https://github.com/medz/alien-signals-dart

environment:
Expand Down

0 comments on commit 59817b8

Please sign in to comment.