aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/CollectionFolder.cs
diff options
context:
space:
mode:
authorNiels van Velzen <nielsvanvelzen@users.noreply.github.com>2026-05-03 21:56:34 +0200
committerGitHub <noreply@github.com>2026-05-03 21:56:34 +0200
commit6e22075a63432aae48859cf9c67fde158dc80d2e (patch)
treec3a33238cc56857d8e3daa56db01f290118c9215 /MediaBrowser.Controller/Entities/CollectionFolder.cs
parentd9ced0d6399c82ddad9e983605bb0d828a608e63 (diff)
parentd68d0fa96267ad96eaa5a0ba37e072f59a71442a (diff)
Merge pull request #16062 from Shadowghost/perf-rebased
Query Performance Improvements
Diffstat (limited to 'MediaBrowser.Controller/Entities/CollectionFolder.cs')
-rw-r--r--MediaBrowser.Controller/Entities/CollectionFolder.cs24
1 files changed, 22 insertions, 2 deletions
diff --git a/MediaBrowser.Controller/Entities/CollectionFolder.cs b/MediaBrowser.Controller/Entities/CollectionFolder.cs
index ca79e62454..ffdc8421da 100644
--- a/MediaBrowser.Controller/Entities/CollectionFolder.cs
+++ b/MediaBrowser.Controller/Entities/CollectionFolder.cs
@@ -45,6 +45,11 @@ namespace MediaBrowser.Controller.Entities
}
/// <summary>
+ /// Event raised when library options are updated for any collection folder.
+ /// </summary>
+ public static event EventHandler<LibraryOptionsUpdatedEventArgs> LibraryOptionsUpdated;
+
+ /// <summary>
/// Gets the display preferences id.
/// </summary>
/// <remarks>
@@ -74,14 +79,27 @@ namespace MediaBrowser.Controller.Entities
public CollectionType? CollectionType { get; set; }
/// <summary>
- /// Gets the item's children.
+ /// Gets or sets the item's children.
/// </summary>
/// <remarks>
/// Our children are actually just references to the ones in the physical root...
+ /// Setting to null propagates invalidation to physical folders since the getter
+ /// always delegates to <see cref="GetActualChildren"/> and never reads the backing field.
/// </remarks>
/// <value>The actual children.</value>
[JsonIgnore]
- public override IEnumerable<BaseItem> Children => GetActualChildren();
+ public override IEnumerable<BaseItem> Children
+ {
+ get => GetActualChildren();
+ set
+ {
+ // The getter delegates to physical folders, so invalidate their caches.
+ foreach (var folder in GetPhysicalFolders(true))
+ {
+ folder.Children = null;
+ }
+ }
+ }
[JsonIgnore]
public override bool SupportsPeople => false;
@@ -168,6 +186,8 @@ namespace MediaBrowser.Controller.Entities
}
XmlSerializer.SerializeToFile(clone, GetLibraryOptionsPath(path));
+
+ LibraryOptionsUpdated?.Invoke(null, new LibraryOptionsUpdatedEventArgs(path, options));
}
public static void OnCollectionFolderChange()