Skip to content

Commit cc9d48d

Browse files
authored
Fix: Fixed issue where details pane would sometimes fail to load (#12514)
1 parent e22d04d commit cc9d48d

File tree

2 files changed

+7
-20
lines changed

2 files changed

+7
-20
lines changed

src/Files.App/UserControls/Pane/PreviewPane.xaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,10 @@
147147
IsChecked="{x:Bind PaneSettingsService.ShowPreviewOnly, Mode=TwoWay, Converter={StaticResource BoolNegationConverter}}"
148148
Style="{StaticResource Local.RadioButtonStyle}" />
149149
<!-- Preview -->
150-
<RadioButton Content="{helpers:ResourceString Name=Preview}" Style="{StaticResource Local.RadioButtonStyle}" />
150+
<RadioButton
151+
Content="{helpers:ResourceString Name=Preview}"
152+
IsChecked="{x:Bind PaneSettingsService.ShowPreviewOnly, Mode=TwoWay}"
153+
Style="{StaticResource Local.RadioButtonStyle}" />
151154
</StackPanel>
152155

153156
<Grid

src/Files.App/ViewModels/UserControls/PreviewPaneViewModel.cs

Lines changed: 3 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public PreviewPaneViewModel(IUserSettingsService userSettings, IPreviewPaneSetti
7373
userSettingsService = userSettings;
7474
previewSettingsService = previewSettings;
7575

76-
ShowPreviewOnlyInvoked = new RelayCommand(() => UpdateSelectedItemPreview());
76+
ShowPreviewOnlyInvoked = new RelayCommand(async () => await UpdateSelectedItemPreview());
7777

7878
IsEnabled = previewSettingsService.IsEnabled;
7979

@@ -286,12 +286,12 @@ public async Task UpdateSelectedItemPreview(bool downloadItem = false)
286286

287287
public ICommand ShowPreviewOnlyInvoked { get; }
288288

289-
private void UserSettingsService_OnSettingChangedEvent(object sender, SettingChangedEventArgs e)
289+
private async void UserSettingsService_OnSettingChangedEvent(object sender, SettingChangedEventArgs e)
290290
{
291291
if (e.SettingName is nameof(IPreviewPaneSettingsService.ShowPreviewOnly))
292292
{
293293
// The preview will need refreshing as the file details won't be accurate
294-
needsRefresh = true;
294+
await UpdateSelectedItemPreview();
295295
}
296296
}
297297

@@ -324,22 +324,6 @@ private async Task LoadBasicPreviewAsync()
324324
}
325325
}
326326

327-
/// <summary>
328-
/// true if the content needs to be refreshed the next time the model is used
329-
/// </summary>
330-
private bool needsRefresh = false;
331-
332-
/// <summary>
333-
/// refreshes the content if it needs to be refreshed, does nothing otherwise
334-
/// </summary>
335-
public void TryRefresh()
336-
{
337-
if (needsRefresh)
338-
{
339-
UpdateSelectedItemPreview();
340-
}
341-
}
342-
343327
public void Dispose()
344328
{
345329
userSettingsService.OnSettingChangedEvent -= UserSettingsService_OnSettingChangedEvent;

0 commit comments

Comments
 (0)