The decisions extension tore down and re-contributed the decisions.detail context-panel tab on every selection, racing the view's own subscription and leaving the panel unrevealed — so clicking a decision often did nothing. Match the working ticket panel: contribute the tab once (static), and on selection just reveal the context panel and activateTab; DecisionDetailView loads via its existing subscription. T-188. Co-Authored-By: Claude <noreply@anthropic.com>
54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:clide/builtin/decisions/src/decision_detail_view.dart';
|
|
import 'package:clide/builtin/decisions/src/decisions_view.dart';
|
|
import 'package:clide/extension/extension.dart';
|
|
import 'package:clide/kernel/kernel.dart';
|
|
import 'package:clide/widgets/widgets.dart';
|
|
|
|
class DecisionsExtension extends ClideExtension {
|
|
@override
|
|
String get id => 'builtin.decisions';
|
|
@override
|
|
String get title => 'Decisions';
|
|
@override
|
|
String get version => '0.6.0';
|
|
@override
|
|
List<String> get dependsOn => const [];
|
|
|
|
StreamSubscription<Message>? _sub;
|
|
|
|
@override
|
|
Future<void> activate(ClideExtensionContext ctx) async {
|
|
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((msg) {
|
|
if (msg.data['id'] is! String) return;
|
|
ctx.arrangement.setVisible(Slots.contextPanel, true);
|
|
ctx.arrangement.setCollapsed(Slots.contextPanel, false);
|
|
ctx.panels.activateTab(Slots.contextPanel, 'decisions.detail');
|
|
});
|
|
}
|
|
|
|
@override
|
|
Future<void> deactivate() async => _sub?.cancel();
|
|
|
|
@override
|
|
List<ContributionPoint> get contributions => [
|
|
TabContribution(
|
|
id: 'decisions.panel',
|
|
slot: Slots.sidebar,
|
|
title: 'Decisions',
|
|
titleKey: 'tab.title',
|
|
i18nNamespace: id,
|
|
icon: PhosphorIcons.lightbulb,
|
|
build: (_) => const DecisionsView(),
|
|
),
|
|
TabContribution(
|
|
id: 'decisions.detail',
|
|
slot: Slots.contextPanel,
|
|
title: 'Decision',
|
|
icon: PhosphorIcons.lightbulb,
|
|
build: (_) => const DecisionDetailView(),
|
|
),
|
|
];
|
|
}
|