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

Add Autoload Last File Option #183

Merged
merged 1 commit into from
Feb 23, 2025
Merged

Add Autoload Last File Option #183

merged 1 commit into from
Feb 23, 2025

Conversation

dreamsyntax
Copy link
Collaborator

@dreamsyntax dreamsyntax commented Feb 22, 2025

Implements #121

image

This feature autoloads the last .DMW you have previously loaded.
This is useful if working on a .DMW file you regularly commit to a shared repository.

  • Enabling the feature will stop saving to the 'temporary' watchlist space.
  • Disabling the feature will clear your current watchlist (giving you an opportunity to save it if you have not), and then load the old 'temporary' watchlist.
  • Closing DME will now prompt you to save if this mode is on and you have not saved

Changes

  • Clearing the watchlist now also drops the file reference
  • Closing DME while the Auto-load checkbox is enabled will prompt you if you have unsaved changes, just like if two DME instances are running.
  • This is NOT enabled by default.
  • Makes m_watchListFile public - necessary to get file location, and to be used later in Feature: Display 'active' opened .DMW file #182
TODOs (All Done) [WONTDO] // TODO: Potentially restoreWatchModel first, then openWatchFile in autoload scenario. If they don't match, warn/prompt unsaved changes in model.

[x] Do we want auto-load by default - No, for now we will default to off

[x] Potentially a way to switch between 'scratch' (the stored watchmodel in the config) and files on the fly? - The config watchlist will not be saved, that way you can turn off the feature to switch between them

[x] Lint

[x] Ensure when a user toggles the feature on/off the stored watchmodel is not overwritten. Warn the user if unsaved changes, and then reload the watchlist, or prompt to save it

[x] Don't save the config/scratch stored watchlist if this feature is enabled - prevents data loss

@dreamsyntax
Copy link
Collaborator Author

dreamsyntax commented Feb 22, 2025

Regarding:

[ ] // TODO: Potentially restoreWatchModel first, then openWatchFile in autoload scenario. If they don't match, warn/prompt unsaved changes in model.
[ ] Do we want auto-load by default

My initial thought on the easiest and 'safe' approach to not disrupt user flows is to always load the stored watchlist from the config first, then load the last saved file. If they don't match 1:1 a warning is shown giving the user a chance to save the scratch, or alternatively load it instead of the file.

This works for single users working on a DMW list. However, once you introduce a shared DMW in a git repo with a team working on it, the flow can get annoying.

  1. User A and User B pull the current DMW; Both are using auto-load mode in DME.
  2. User A makes changes, and commits changes.
  3. User B had been using the prior commit DMW, but did not make any changes. They close DMW, and later pull the new commit.
  4. A few weeks go by, etc, User B has not opened DME, forgetting the above.
  5. User B opens DMW. The autoload will occur and a mismatch of the config stored watchlist and the DMW will result in the warning/popup that the file does not match the scratch stored watchlist.

So long as the user 'knows' they had nothing, they could simplify tell the popup to discard and load from the file.
I don't consider this flow fully ideal, but I'm not sure what else can be done. Maybe date based checks? Although that doesn't seem very useful either.

@dreamsyntax
Copy link
Collaborator Author

I've mulled it over a bit.

I think for now, I want to disable this feature by default, and that way I can ignore doing the compare with the scratch/temp watchlist. As users decide which they prefer, they can safely migrate to the feature being enabled if that works best for them.

This also solves the multi user situation since the scratch would be ignored completely, so user B would not receive the false pop up in the above scenario.

@dreamsyntax dreamsyntax marked this pull request as ready for review February 23, 2025 00:36
@dreamsyntax dreamsyntax changed the title Autoload Last File Add Autoload Last File Option Feb 23, 2025
This feature autoloads the last .DMW you have previously loaded.
This is useful if working on a .DMW file you regularly commit to a
shared repository.

- Enabling the feature will stop saving to the 'temporary' watchlist
  space.
- Disabling the feature will clear your current watchlist (giving you
  an opportunity to save it if you have not), and then load the old
  'temporary' watchlist.
- Closing DME will now prompt you to save if this mode is on and you
  have not saved
- Clearing the watchlist now also drops the file reference
@dreamsyntax dreamsyntax merged commit 6c600f4 into master Feb 23, 2025
4 checks passed
@dreamsyntax dreamsyntax deleted the autoload-feature branch February 23, 2025 23:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants