Skip to content

Commit

Permalink
fix(web) - actually navigate to the view a user is on
Browse files Browse the repository at this point in the history
  • Loading branch information
wendybujalski committed Dec 12, 2024
1 parent 5375786 commit 710e8df
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
30 changes: 14 additions & 16 deletions app/web/src/components/layout/navbar/Collaborators.vue
Original file line number Diff line number Diff line change
Expand Up @@ -102,23 +102,22 @@ import { useRoute, useRouter } from "vue-router";
import Popover from "@/components/Popover.vue";
import { usePresenceStore } from "@/store/presence.store";
import { useChangeSetsStore } from "@/store/change_sets.store";
import { useViewsStore } from "@/store/views.store";
import UserIcon from "./UserIcon.vue";
import UserCard from "./UserCard.vue";
const presenceStore = usePresenceStore();
const changeSetsStore = useChangeSetsStore();
const viewsStore = useViewsStore();
const router = useRouter();
const route = useRoute();
export type UserInfo = {
name: string;
color?: string | null;
status?: string | null;
changeSet?: string;
changeSet?: string; // TODO(Wendy) - this should be called changeSetId
pictureUrl?: string | null;
view?: string;
view?: string; // TODO(Wendy) - this should be called viewId
// TODO(Wendy) - we should probably also send the viewName so we can show it in the tooltip
};
const moreUsersPopoverRef = ref();
Expand Down Expand Up @@ -284,24 +283,23 @@ function goToUserChangeSet(user: UserInfo) {
if (!user || !user.changeSet) return;
if (user.view) {
const viewId = viewsStore.viewsById[user.view]?.id;
if (viewId) {
router.push({
name: "workspace-compose-view",
params: {
...route.params,
viewId,
},
query: route.query,
});
}
router.push({
name: "workspace-compose-view",
params: {
...route.params,
changeSetId: user.changeSet,
viewId: user.view,
},
query: route.query,
});
return;
}
router.push({
name: "change-set-home",
params: {
...route.params,
changeSetId: changeSetsStore.changeSetsById[user.changeSet]?.id || "auto",
changeSetId: user.changeSet,
},
query: route.query,
});
Expand Down
9 changes: 8 additions & 1 deletion app/web/src/store/views.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,15 @@ export const useViewsStore = (forceChangeSetId?: ChangeSetId) => {
const stopWatchingUrl = watch(
router.currentRoute,
() => {
if (router.currentRoute.value.name === "workspace-compose")
if (
router.currentRoute.value.name === "workspace-compose" ||
router.currentRoute.value.name === "workspace-compose-view"
)
this.syncUrlIntoSelection();
const viewId = router.currentRoute.value.params.viewId;
if (viewId) {
this.selectView(viewId as string);
}
},
{
immediate: true,
Expand Down

0 comments on commit 710e8df

Please sign in to comment.