Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

This change ports the core functionality of Wire.data from the TypeScript version of the library to the Dart version.

This includes:

  • Adding generics to WireData for type safety.
  • Implementing listener execution modes (sequential and parallel).
  • Adding an onError callback for robust error handling.
  • Making the unsubscribe method asynchronous to prevent race conditions.

PR created automatically by Jules for task 356584983162170934 started by @VladimirCores

@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

Comment on lines 45 to 48
if (!_wireById.containsKey(wireId)) continue;
final wire = _wireById[wireId]!;
if (isLookingInScope && wire.scope != scope) continue;
final result = await wire.transfer(payload).catchError(_processSendError);
if (wire.withReplies && --wire.replies == 0) {
await _removeWire(wire);
}
if (result != null) {
results.add(result);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules extract the logic of "transfer on each wire" into separate private method returning result

Comment on lines 274 to 275
final isValueFunction = value is WireValueFunction;
final nextValue = isValueFunction ? value(prevValue) : value;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules keep original version of that code

Comment on lines 58 to 61
final result = await wire.transfer(payload).catchError(_processSendError);
if (wire.withReplies && --wire.replies == 0) {
await _removeWire(wire);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jules looks like this code has a problem because during wire.transfer there might be another send of same signal (within async call) thus the transfer will happen again even when wire.replies is already 0. Evaluate this case, write tests to cover the case, and fix the code.

Vladimir Minkin and others added 5 commits January 5, 2026 18:08
…s file. The linter rules have been updated to better reflect current best practices and remove unnecessary configurations.
This commit addresses all outstanding feedback from the previous code reviews:

- The `remove` method in `WireDataContainerLayer` has been reverted to be private (`_remove`).
- The original logic in the `data` method of the `Wire` class has been restored.
- All previously removed commented-out `print` statements have been restored.
This commit ports the core functionality of `Wire.data` from the TypeScript version of the library to the Dart version to achieve feature parity.

- Introduces generics (`WireData<T>`) for type safety.
- Adds listener execution modes (`SEQUENTIAL` and `PARALLEL`).
- Implements an `onError` callback mechanism for robust error handling.
- Implements an asynchronous `unsubscribe` method to handle in-flight data refreshes correctly.
- Adds a runtime type check in `Wire.data<T>()` to prevent unsafe casting.
- Fixes a race condition where a wire with `replies: 1` could be called multiple times during re-entrant `send` calls.
- The test suite has been extended to cover all new functionality and the race condition fix.
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