Skip to content

Commit

Permalink
Merge pull request #5172 from systeminit/jobelenus/new-changeset-keep…
Browse files Browse the repository at this point in the history
…s-view

Fix: when creating a new change set stay on the view you're on
  • Loading branch information
jobelenus authored Dec 19, 2024
2 parents dd0a007 + 83345b6 commit a6021ae
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/web/src/components/ApprovalPendingModalCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ defineProps({
});
const goToChangeSet = (id: ChangeSetId) => {
changeSetsStore.setActiveChangeset(id);
changeSetsStore.setActiveChangeset(id, true);
emit("closeModal");
};
const rejectChangeSet = (id: ChangeSetId) => {
Expand Down
3 changes: 1 addition & 2 deletions app/web/src/components/layout/navbar/ChangeSetPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ function onSelectChangeSet(newVal: string) {
// keep everything in the current route except the change set id
// note - we use push here, so there is a new browser history entry
let name = route.name;
if (name === "workspace-compose-view") name = "workspace-compose";
const name = route.name;
router.push({
name,
params: {
Expand Down
1 change: 1 addition & 0 deletions app/web/src/store/apis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ async function handleForcedChangesetRedirection(response: AxiosResponse) {
const changeSetsStore = useChangeSetsStore();
await changeSetsStore.setActiveChangeset(
response.headers.force_change_set_id,
true,
);
}

Expand Down
6 changes: 3 additions & 3 deletions app/web/src/store/change_sets.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export function useChangeSetsStore() {
selectedWorkspacePk: () => workspacePk,
},
actions: {
async setActiveChangeset(changeSetId: string) {
async setActiveChangeset(changeSetId: string, stayOnView = false) {
// We need to force refetch changesets since there's a race condition in which redirects
// will be triggered but the frontend won't have refreshed the list of changesets
if (!this.changeSetsById[changeSetId]) {
Expand All @@ -132,7 +132,7 @@ export function useChangeSetsStore() {
const params = { ...route.params };
let name = route.name;
// if abandoning changeset and you were looking at view, it may not exist in HEAD
if (name === "workspace-compose-view") {
if (!stayOnView && name === "workspace-compose-view") {
name = "workspace-compose";
delete params.viewId;
}
Expand Down Expand Up @@ -530,7 +530,7 @@ export function useChangeSetsStore() {
const changeSetName = this.selectedChangeSet?.name;
if (data.changeSetId === this.selectedChangeSetId) {
if (this.headChangeSetId) {
await this.setActiveChangeset(this.headChangeSetId);
await this.setActiveChangeset(this.headChangeSetId, false);
toast({
component: MovedToHead,
props: {
Expand Down

0 comments on commit a6021ae

Please sign in to comment.