Skip to content

Adding a collection doesn't open the active loadout workspace #3188

Closed
@erri120

Description

@erri120

private Optional<(LoadoutId, WorkspaceId)> GetWorkspaceIdForGame(IWorkspaceController workspaceController, GameId gameId)
{
if (workspaceController.ActiveWorkspace.Context is LoadoutContext existingLoadoutContext && IsCorrectLoadoutForGame(existingLoadoutContext.LoadoutId, gameId))
return (existingLoadoutContext.LoadoutId, workspaceController.ActiveWorkspaceId);
var loadoutId = GetActiveLoadoutForGame(gameId);
if (!loadoutId.HasValue) return Optional<(LoadoutId, WorkspaceId)>.None;
var workspaceViewModel = workspaceController.ChangeOrCreateWorkspaceByContext(
predicate: loadoutContext => IsCorrectLoadoutForGame(loadoutContext.LoadoutId, gameId),
getPageData: () => Optional<PageData>.None,
getWorkspaceContext: () => new LoadoutContext
{
LoadoutId = loadoutId.Value,
}
);
return (loadoutId.Value, workspaceViewModel.Id);
}

We have the correct Loadout ID but the predicate for ChangeOrCreateWorkspaceByContext isn't getting the workspace for that loadout but just any loadout for the game.

Metadata

Metadata

Assignees

Labels

Epic: CollectionsThis is related to NexusMods Collections.Epic: Workspace SystemThis is related to the Panels/Workspace system

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions