Let primary summary reads precede optional validation

This commit is contained in:
2026-11-05 15:47:19 +00:00
parent 3a9ba55277
commit b8d3eaad35
3 changed files with 43 additions and 8 deletions
@@ -44,20 +44,24 @@ class _PipelineDefinitionValidationState
}
void _load({bool retry = false}) {
if (widget.source.trim().isEmpty) {
final source = widget.source;
final gateway = widget.gateway;
if (source.trim().isEmpty) {
_result = Future.value({'type': 'validated'});
return;
}
final cache = _checks[widget.gateway] ??= {};
if (retry) cache.remove(widget.source);
if (!cache.containsKey(widget.source) && cache.length >= 16) {
final cache = _checks[gateway] ??= {};
if (retry) cache.remove(source);
if (!cache.containsKey(source) && cache.length >= 16) {
cache.remove(cache.keys.first);
}
_result = cache.putIfAbsent(
widget.source,
() => Future.sync(
() => widget.gateway.call('validate', {'source': widget.source}),
),
source,
// Primary summary sections enqueue their reads while mounting. The
// transport serializes replies, so optional validation waits until those
// reads have been queued. A microtask adds no lingering timer on dispose.
() =>
Future.microtask(() => gateway.call('validate', {'source': source})),
);
}