Using, the standard Apple example at https://developer.apple.com/documentation/swiftui/building-a-document-based-app-with-swiftui
I only made a small change to print when reading a file, with the time.
When you use 'revert to saved', it writes the current version (expected), then loads the saved version (expected), then a few seconds later (not moving the mouse, edits, etc.) it reloads the document again. Then if you click away from the window, it loads it yet again - four times!
This loading of the document twice breaks apps where the loading may take longer (large documents), then the document is replaced while the user has already started editing the recently loaded document.
This is a really bad bug. Any ideas?
Here is the added logs:
reading file! testfile.story at 2025-03-11 20:35:16 +0000
saving file! testfile.story at 2025-03-11 20:35:27 +0000
reading file! testfile.story at 2025-03-11 20:35:27 +0000
reading file! testfile.story at 2025-03-11 20:35:30 +0000
reading file! testfile.story at 2025-03-11 20:35:31 +0000
I see the same behavior with 'Revert To Last Opened'. It seems to work as expected when you browse all versions and pick a specific version.