Skip to content

Commit 1ba1b5c

Browse files
committed
fix issues
1 parent e3544f2 commit 1ba1b5c

2 files changed

Lines changed: 33 additions & 27 deletions

File tree

packages/devtools_app/lib/src/screens/memory/panes/profile/profile_pane_controller.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ class ProfilePaneController extends DisposableController
2929
_pinnedClassFullNames.addAll(pinnedClassFullNames);
3030
_pinnedClassFullNamesListenable.value = pinnedClassFullNames;
3131
}
32+
_pinnedClassFullNamesListenable.value = Set.of(_pinnedClassFullNames);
3233
// [profile] should only be non-null when loading offline data.
3334
if (profile != null) {
3435
_currentAllocationProfile.value = AdaptedProfile.withPinnedClasses(

packages/devtools_app/lib/src/screens/memory/panes/profile/profile_view.dart

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -580,6 +580,18 @@ class _AllocationProfileTableState extends State<_AllocationProfileTable> {
580580
@override
581581
void initState() {
582582
super.initState();
583+
_initColumns();
584+
}
585+
586+
@override
587+
void didUpdateWidget(covariant _AllocationProfileTable oldWidget) {
588+
super.didUpdateWidget(oldWidget);
589+
if (oldWidget.controller != widget.controller) {
590+
_initColumns();
591+
}
592+
}
593+
594+
void _initColumns() {
583595
_pinColumn = _PinColumn(controller: widget.controller);
584596
_columns = <ColumnData<ProfileRecord>>[
585597
_pinColumn,
@@ -607,33 +619,26 @@ class _AllocationProfileTableState extends State<_AllocationProfileTable> {
607619
if (profile == null) {
608620
return const CenteredCircularProgressIndicator();
609621
}
610-
return ValueListenableBuilder<Set<String>>(
611-
valueListenable: widget.controller.pinnedClassFullNames,
612-
builder: (context, pinnedClassFullNames, _) {
613-
return ValueListenableBuilder<bool>(
614-
valueListenable: preferences.advancedDeveloperModeEnabled,
615-
builder: (context, advancedDeveloperModeEnabled, _) {
616-
return FlatTable<ProfileRecord>(
617-
keyFactory: (element) => Key(element.heapClass.fullName),
618-
data: profile.records,
619-
dataKey:
620-
'allocation-profile-${pinnedClassFullNames.length}-'
621-
'${pinnedClassFullNames.toList()..sort()}',
622-
columnGroups: advancedDeveloperModeEnabled
623-
? _AllocationProfileTableState._vmModeColumnGroups
624-
: null,
625-
columns: [
626-
..._columns,
627-
if (advancedDeveloperModeEnabled)
628-
..._advancedDeveloperModeColumns,
629-
],
630-
defaultSortColumn: _AllocationProfileTableState._fieldSizeColumn,
631-
defaultSortDirection: SortDirection.descending,
632-
pinBehavior: FlatTablePinBehavior.pinOriginalToTop,
633-
includeColumnGroupHeaders: false,
634-
selectionNotifier: widget.controller.selection,
635-
);
636-
},
622+
return ValueListenableBuilder<bool>(
623+
valueListenable: preferences.advancedDeveloperModeEnabled,
624+
builder: (context, advancedDeveloperModeEnabled, _) {
625+
return FlatTable<ProfileRecord>(
626+
keyFactory: (element) => Key(element.heapClass.fullName),
627+
data: profile.records,
628+
dataKey: 'allocation-profile',
629+
columnGroups: advancedDeveloperModeEnabled
630+
? _AllocationProfileTableState._vmModeColumnGroups
631+
: null,
632+
columns: [
633+
..._columns,
634+
if (advancedDeveloperModeEnabled)
635+
..._advancedDeveloperModeColumns,
636+
],
637+
defaultSortColumn: _AllocationProfileTableState._fieldSizeColumn,
638+
defaultSortDirection: SortDirection.descending,
639+
pinBehavior: FlatTablePinBehavior.pinOriginalToTop,
640+
includeColumnGroupHeaders: false,
641+
selectionNotifier: widget.controller.selection,
637642
);
638643
},
639644
);

0 commit comments

Comments
 (0)