Skip to content

Commit

Permalink
Filter out local elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nytra committed Jun 27, 2024
1 parent 6f82e7a commit 400e755
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ public class ComponentsDataFeed : Component, IDataFeedComponent, IDataFeed, IWor

private void AddComponent(Component c)
{
if (c.IsLocalElement) return;
foreach (KeyValuePair<SearchPhraseFeedUpdateHandler, ComponentsDataFeedData> updateHandler in _updateHandlers)
{
var data = updateHandler.Value.RegisterComponent(c);
foreach (ISyncMember syncMember in data.component.SyncMembers)
{
if (syncMember.IsLocalElement) continue;
data.AddMember(syncMember);
}
ProcessUpdate(updateHandler.Key, data);
Expand Down Expand Up @@ -175,9 +177,12 @@ public async IAsyncEnumerable<DataFeedItem> Enumerate(IReadOnlyList<string> path
var components = IncludeChildrenSlots ? TargetSlot.Target.GetComponentsInChildren<Component>() : TargetSlot.Target.GetComponents<Component>();
foreach (Component allComponent in components)
{
// If local elements are written to synced fields it can cause exceptions and crashes
if (allComponent.IsLocalElement) continue;
componentDataFeedData.RegisterComponent(allComponent);
foreach (ISyncMember syncMember in allComponent.SyncMembers)
{
if (syncMember.IsLocalElement) continue;
componentDataFeedData.AddMember(syncMember);
}
}
Expand Down

0 comments on commit 400e755

Please sign in to comment.