Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicitly reset any cached data in table tab when changing tables #313

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/widgets/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ class _TableWidgetState extends State<TableWidget> {
}

Future<void> _loadData(String selectedTable) async {
// Clear the existing data to avoid any strange "cache" issues
setState(() {
_data = [];
});

List<Map<String, dynamic>> data;
if (selectedTable == 'exercises') {
data = await widget.dbHelper.getExercises(
Expand All @@ -103,8 +108,9 @@ class _TableWidgetState extends State<TableWidget> {
data = [];
}

// Create a mutable copy to allow manipulation
setState(() {
_data = List<Map<String, dynamic>>.from(data); // Create a mutable copy
_data = List<Map<String, dynamic>>.from(data);
});
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 0.8.6+42
version: 0.8.7+43

environment:
sdk: '>=3.4.3 <4.0.0'
Expand Down
Loading