diff options
-rw-r--r-- | Source/SPDatabaseViewController.m | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/Source/SPDatabaseViewController.m b/Source/SPDatabaseViewController.m index cb5b5bb2..0ea8216e 100644 --- a/Source/SPDatabaseViewController.m +++ b/Source/SPDatabaseViewController.m @@ -434,15 +434,11 @@ // Restore view states as appropriate [spHistoryControllerInstance restoreViewStates]; - // Reset all loaded views + // Mark that all loaded views require their data reloading structureLoaded = NO; contentLoaded = NO; statusLoaded = NO; triggersLoaded = NO; - [tableSourceInstance loadTable:nil]; - [tableContentInstance loadTable:nil]; - [[extendedTableInfoInstance onMainThread] loadTable:nil]; - [[tableTriggersInstance onMainThread] loadTriggers]; // Load the currently selected view if looking at a table or view if (tableEncoding && (selectedTableType == SPTableTypeView || selectedTableType == SPTableTypeTable)) @@ -469,6 +465,14 @@ } } + // Clear any views which haven't been loaded as they weren't visible. Note + // that this should be done after reloading visible views, instead of clearing all + // views, to reduce UI operations and avoid resetting state unnecessarily. + if (!structureLoaded) [tableSourceInstance loadTable:nil]; + if (!contentLoaded) [tableContentInstance loadTable:nil]; + if (!statusLoaded) [[extendedTableInfoInstance onMainThread] loadTable:nil]; + if (!triggersLoaded) [[tableTriggersInstance onMainThread] loadTriggers]; + // Update the "Show Create Syntax" window if it's already opened // according to the selected table/view/proc/func if([[[self onMainThread] getCreateTableSyntaxWindow] isVisible]) |