diff --git a/flake.nix b/flake.nix index 5c5c2b71..5a46cd6b 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ nixpkgs.follows = "holonix/nixpkgs"; holonix.url = "github:holochain/holonix/main-0.3"; hc-infra.url = "github:holochain-open-dev/infrastructure"; - p2p-shipyard.url = "github:darksoil-studio/p2p-shipyard/develop"; + p2p-shipyard.url = "github:darksoil-studio/p2p-shipyard"; playground.url = "github:darksoil-studio/holochain-playground"; linked-devices.url = "github:darksoil-studio/linked-devices"; }; diff --git a/ui/src/elements/profile-prompt.ts b/ui/src/elements/profile-prompt.ts index 19402d77..18e19d1c 100644 --- a/ui/src/elements/profile-prompt.ts +++ b/ui/src/elements/profile-prompt.ts @@ -73,8 +73,10 @@ export class ProfilePrompt extends SignalWatcher(LitElement) { await this.store.client.getAgentProfile(linkedDevice); if (profileForLinkedDeviceLinks.length > 0) { - const profileForLinkedDevice = - profileForLinkedDeviceLinks[0].target; + const latestLink = profileForLinkedDeviceLinks.sort( + (l1, l2) => l2.timestamp - l1.timestamp, + )[0]; + const profileForLinkedDevice = latestLink.target; await this.store.client.linkMyAgentToProfile( profileForLinkedDevice, ); diff --git a/ui/src/profiles-store.ts b/ui/src/profiles-store.ts index 9a98a61c..28c83637 100644 --- a/ui/src/profiles-store.ts +++ b/ui/src/profiles-store.ts @@ -75,7 +75,10 @@ export class ProfilesStore { // TODO: handle multiple links gracefully - const profileHash = links.value[0].target; + const latestLink = links.value.sort( + (l1, l2) => l2.timestamp - l1.timestamp, + )[0]; + const profileHash = latestLink.target; return { status: 'completed', value: this.profiles.get(profileHash),