Skip to content

Commit

Permalink
Clear cached PublishedDataTypes when content types are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ronaldbarendse committed Nov 17, 2023
1 parent 0085f98 commit c2a80fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ IPublishedPropertyType CreateCorePropertyType(
/// <para>This is so the factory can flush its caches.</para>
/// <para>Invoked by the IPublishedSnapshotService.</para>
/// </remarks>
void NotifyDataTypeChanges(int[] ids);
void NotifyDataTypeChanges(params int[] ids);
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public PublishedDataType GetDataType(int id)
}

/// <inheritdoc />
public void NotifyDataTypeChanges(int[] ids)
public void NotifyDataTypeChanges(params int[] ids)
{
lock (_publishedDataTypesLocker)
{
if (_publishedDataTypes == null)
if (_publishedDataTypes == null || ids.Length == 0)
{
IEnumerable<IDataType> dataTypes = _dataTypeService.GetAll();
_publishedDataTypes = dataTypes.ToDictionary(x => x.Id, CreatePublishedDataType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ public void Notify(ContentTypeCacheRefresher.JsonPayload[] payloads)
}
}

// Ensure all published data types are updated
_publishedContentTypeFactory.NotifyDataTypeChanges();

Notify<IContentType>(_contentStore, payloads, RefreshContentTypesLocked);
Notify<IMediaType>(_mediaStore, payloads, RefreshMediaTypesLocked);

Expand Down

0 comments on commit c2a80fd

Please sign in to comment.