Skip to content

Commit

Permalink
fixing build issue and groupBy and selectedReportType
Browse files Browse the repository at this point in the history
  • Loading branch information
justinbmeyer committed Mar 11, 2025
1 parent d3b5078 commit 00a95ce
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 39 deletions.
48 changes: 10 additions & 38 deletions public/canjs/routing/route-data/route-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ import {
makeArrayOfStringsQueryParamValueButAlsoLookAtReportData,
pushStateObservable,
paramValue,
getUrlParamValue
getUrlParamValue,
makeParamAndReportDataReducer,
listenToReportDataChanged,
listenToUrlChange
} from "../state-storage.js";

import { roundDate } from "../../../utils/date/round.js";
Expand Down Expand Up @@ -372,7 +375,7 @@ export class RouteData extends ObservableObject {
const resolveValue = () => {
const urlParamValue = getUrlParamValue("timingCalculations");;
const reportParamValue = this.reportData && paramValue(this.reportData, "timingCalculations");
//console.log("timingCalculations", {urlParamValue, reportParamValue});

if(urlParamValue != null) {
parseAndResolve(urlParamValue)
} else if(reportParamValue != null){
Expand Down Expand Up @@ -445,7 +448,6 @@ export class RouteData extends ObservableObject {
},
selectedIssueType: {
enumerable: true,
/*
value({ resolve, lastSet, listenTo }) {
let reportDataParam;
let urlParam;
Expand Down Expand Up @@ -531,7 +533,8 @@ export class RouteData extends ObservableObject {
});

resolveCurrentValue();
},*/
},
/*
value({ resolve, lastSet, listenTo }) {
function getParamValue() {
return new URL(window.location).searchParams.get("selectedIssueType") || "";
Expand Down Expand Up @@ -600,7 +603,7 @@ export class RouteData extends ObservableObject {
});
resolveCurrentValue();
},
},*/
},
get primaryIssueType() {
return this.selectedIssueType && toSelectedParts(this.selectedIssueType).primary;
Expand All @@ -626,7 +629,7 @@ export class RouteData extends ObservableObject {

// GroupBy is not available for release ... so if a release primaryIssueType is set
// then we need to remove it
groupBy: /*makeParamAndReportDataReducer({
groupBy: makeParamAndReportDataReducer({
key: "groupBy",
defaultValue: "",

Expand All @@ -644,38 +647,7 @@ export class RouteData extends ObservableObject {
}
}
}
})*/

{
enumerable: true,
value({ resolve, lastSet, listenTo }) {
function getFromParam() {
return new URL(window.location).searchParams.get("groupBy") || "";
}

const reconcileCurrentValue = (primaryIssueType, currentGroupBy) => {
if (primaryIssueType === "Release") {
updateUrlParam("groupBy", "", "");
} else {
updateUrlParam("groupBy", currentGroupBy, "");
}
};

listenTo("primaryIssueType", ({ value }) => {
reconcileCurrentValue(value, getFromParam());
});

listenTo(lastSet, (value) => {
updateUrlParam("groupBy", value || "", "");
});

listenTo(pushStateObservable, () => {
resolve(getFromParam());
});

resolve(getFromParam());
},
},
})
};
}

Expand Down
1 change: 1 addition & 0 deletions public/canjs/routing/route-data/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ type Overrides = {
statusesToExclude: string[];
primaryIssueType: string;
secondaryIssueType: string;
groupBy: string;
};

type RouteDataProps = typeof RouteDataClass.props;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ const useGroupBy = () => {
const selectedGroupBy = useCanObservable<string>(value.from(routeData, "groupBy"));

const setSelectedGroupBy = (value: string) => {
// @ts-expect-error
routeData.groupBy = value;
};

Expand Down

0 comments on commit 00a95ce

Please sign in to comment.