Skip to content

Added option to reload content when restoring a file.#55

Open
Avid29 wants to merge 2 commits intodotnet:devfrom
Avid29:LoadModifiedFiles
Open

Added option to reload content when restoring a file.#55
Avid29 wants to merge 2 commits intodotnet:devfrom
Avid29:LoadModifiedFiles

Conversation

@Avid29
Copy link
Contributor

@Avid29 Avid29 commented Jan 7, 2026

This is used to update file content when the program restarts

Fixes #32

PR Type

What kind of change does this PR introduce?

Bugfix

What is the current behavior?

When the app reopens the cached file contents are restored without checking if the file has been modified.

What is the new behavior?

When the app reopens, the cached file contents are overwritten with the contents of the file. No check is made to see if the file has been modified since the app was closed, the file contents will be reloaded. The file contents are still cached, though a file backed document will never utilize them.

Documents not backed by a file still restore cached contents

PR Checklist

Please check if your PR fulfills the following requirements:

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest dev branch of XAML Studio
  • Tested code with current supported SDKs
  • Tests for the changes have been added (if applicable)
  • License Header has been added to all new source files
  • Contains NO breaking changes to save/state files

Other information

Avid29 and others added 2 commits January 7, 2026 11:04
@michael-hawker
Copy link
Contributor

Thanks @Avid29, just looking at this close now that I'm going through the PRs with the CI up and running.

I think we're missing this requirement from the issue:

We should only do that in the case that the file is unmodified, as otherwise we could lose in-progress state.

i.e. we should check the HasChanged here, if it's false. I think we can reload without worry, otherwise we basically end up where the user has modified the document in XAML Studio but not modified it and then the file has also maybe changed on disk.

We probably need some bigger smarts here (maybe with file modification times?) that detects this difference and then just prompts the user with a dialog about if they want to load the newer contents from disk?

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.

File modified on disk not reloaded when XAML Studio opened

2 participants