get rid of old versions of edited nodes when submitting in sim mode

This commit is contained in:
stopflock
2026-02-01 16:02:49 -06:00
parent ba3b844c1e
commit f76268f241
2 changed files with 11 additions and 4 deletions

View File

@@ -104,7 +104,6 @@ cp lib/keys.dart.example lib/keys.dart
## Roadmap
### Needed Bugfixes
- Old nodes are sticking around after edit submissions go through, at least in simulate mode. I think we prune those from cache when in production mode at least?
- Ask for location permission on first launch, temp disable notification permission
- Make submission guide scarier
- Tile cache trimming? Does fluttermap handle?

View File

@@ -533,8 +533,14 @@ class UploadQueueState extends ChangeNotifier {
debugPrint('[UploadQueue] Simulating node operation (no real API call)');
await Future.delayed(const Duration(milliseconds: 500)); // Simulate network delay
// Store simulated node ID and move to changeset close phase
item.submittedNodeId = DateTime.now().millisecondsSinceEpoch;
// Store appropriate simulated node ID based on operation type
if (item.operation == UploadOperation.modify) {
// For edits, keep the original node ID (same as production behavior)
item.submittedNodeId = item.originalNodeId!;
} else {
// For creates and extracts, generate new simulated ID
item.submittedNodeId = DateTime.now().millisecondsSinceEpoch;
}
item.markNodeOperationComplete();
_saveQueue();
notifyListeners();
@@ -668,7 +674,9 @@ class UploadQueueState extends ChangeNotifier {
debugPrint('[UploadQueue] Simulated deletion, removing fake node ID: $simulatedNodeId from cache');
_handleSuccessfulDeletion(item);
} else {
debugPrint('[UploadQueue] Simulated upload, fake node ID: $simulatedNodeId');
debugPrint('[UploadQueue] Simulated upload successful, updating cache with fake node ID: $simulatedNodeId');
// Update cache with simulated node ID, same as production mode
_updateCacheWithRealNodeId(item, simulatedNodeId);
}
}