re-contribute detail tabs with initialId on each selection
Both tickets and decisions extensions now uncontribute and re-contribute the detail tab on every selection, passing the selected ID via initialId. This guarantees the view loads immediately — no first-click miss from the widget not being built when the message fires. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,17 @@ class DecisionsExtension extends ClideExtension {
|
||||
|
||||
@override
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((_) {
|
||||
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((msg) {
|
||||
final selectedId = msg.data['id'] as String?;
|
||||
if (selectedId == null) return;
|
||||
ctx.panels.uncontribute('decisions.detail');
|
||||
ctx.panels.contribute(TabContribution(
|
||||
id: 'decisions.detail',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Decision',
|
||||
icon: PhosphorIcons.lightbulb,
|
||||
build: (_) => DecisionDetailView(initialId: selectedId),
|
||||
));
|
||||
ctx.panels.activateTab(Slots.contextPanel, 'decisions.detail');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,7 +21,17 @@ class TicketsExtension extends ClideExtension {
|
||||
|
||||
@override
|
||||
Future<void> activate(ClideExtensionContext ctx) async {
|
||||
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((_) {
|
||||
_sub = ctx.messages.subscribe(publisher: id, channel: 'selection').listen((msg) {
|
||||
final selectedId = msg.data['id'] as String?;
|
||||
if (selectedId == null) return;
|
||||
ctx.panels.uncontribute('tickets.detail');
|
||||
ctx.panels.contribute(TabContribution(
|
||||
id: 'tickets.detail',
|
||||
slot: Slots.contextPanel,
|
||||
title: 'Ticket',
|
||||
icon: PhosphorIcons.ticket,
|
||||
build: (_) => TicketDetailView(initialId: selectedId),
|
||||
));
|
||||
ctx.panels.activateTab(Slots.contextPanel, 'tickets.detail');
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user