Skip to content

Commit

Permalink
Fix(dui3): do not pass selectedobjectids from idmap (#380)
Browse files Browse the repository at this point in the history
* Do not reset selectedObjectIds from IdMap

* Format
  • Loading branch information
oguzhankoral authored Nov 11, 2024
1 parent c013953 commit 12c80e2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ await _apiContext
return;
}

var selectedObjects = senderModelCard.SendFilter.NotNull().IdMap.NotNull().Values;
var selectedObjects = senderModelCard.SendFilter.NotNull().SelectedObjectIds;

elementIds = selectedObjects
.Select(uid => ElementIdHelper.GetElementIdFromUniqueId(activeUIDoc.Document, uid))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,16 @@ private async Task<List<Element>> RefreshElementsOnSender(SenderModelCard modelC

if (modelCard.SendFilter is not null && modelCard.SendFilter.IdMap is not null)
{
var newSelectedObjectIds = new List<string>();
foreach (Element element in elements)
{
modelCard.SendFilter.IdMap[element.Id.ToString()] = element.UniqueId;
newSelectedObjectIds.Add(element.UniqueId);
}

// We update the state on the UI SenderModelCard to prevent potential inconsistencies between hostApp IdMap in sendfilters.
await Commands
.SetFilterObjectIds(modelCard.ModelCardId.NotNull(), modelCard.SendFilter.IdMap)
.SetFilterObjectIds(modelCard.ModelCardId.NotNull(), modelCard.SendFilter.IdMap, newSelectedObjectIds)
.ConfigureAwait(false);
}

Expand Down
18 changes: 16 additions & 2 deletions DUI3/Speckle.Connectors.DUI/Bindings/SendBindingUICommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,22 @@ public async Task RefreshSendFilters() =>
public async Task SetModelsExpired(IEnumerable<string> expiredModelIds) =>
await Bridge.Send(SET_MODELS_EXPIRED_UI_COMMAND_NAME, expiredModelIds).ConfigureAwait(false);

public async Task SetFilterObjectIds(string modelCardId, Dictionary<string, string> idMap) =>
await Bridge.Send(SET_ID_MAP_COMMAND_NAME, new { modelCardId, idMap }).ConfigureAwait(false);
public async Task SetFilterObjectIds(
string modelCardId,
Dictionary<string, string> idMap,
List<string> newSelectedObjectIds
) =>
await Bridge
.Send(
SET_ID_MAP_COMMAND_NAME,
new
{
modelCardId,
idMap,
newSelectedObjectIds
}
)
.ConfigureAwait(false);

public async Task SetModelSendResult(
string modelCardId,
Expand Down

0 comments on commit 12c80e2

Please sign in to comment.