[WEB-881] fix: Sentry errors from previous build (#4142)

* Sentry Fix for "Non-Error promise rejection captured with value: Route change to url was aborted"

* Sentry fix for "undefined is not an object (evaluating 'n.response')"

* Possible Sentry Fix for "TypeError Function.entries(<anonymous>)"

* Possible Sentry fix for "null is not an object (evaluating 'e.type')"
This commit is contained in:
rahulramesha 2024-04-09 13:12:14 +05:30 committed by GitHub
parent 03df410b52
commit 95580d0c62
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
11 changed files with 32 additions and 27 deletions

View File

@ -189,7 +189,7 @@ function createToolbox({
tippyOptions, tippyOptions,
onSelectColor, onSelectColor,
onClickItem, onClickItem,
colors, colors = {},
}: { }: {
triggerButton: Element | null; triggerButton: Element | null;
items: ToolboxItem[]; items: ToolboxItem[];

View File

@ -19,7 +19,7 @@ type Props = {
export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " "); export const replaceUnderscoreIfSnakeCase = (str: string) => str.replace(/_/g, " ");
export const AppliedFiltersList: React.FC<Props> = (props) => { export const AppliedFiltersList: React.FC<Props> = (props) => {
const { appliedFilters, handleRemoveAllFilters, handleRemoveFilter, states } = props; const { appliedFilters = {}, handleRemoveAllFilters, handleRemoveFilter, states } = props;
return ( return (
<div className="flex flex-wrap items-stretch gap-2 bg-custom-background-100"> <div className="flex flex-wrap items-stretch gap-2 bg-custom-background-100">

View File

@ -15,7 +15,7 @@ import {
import { ILayoutDisplayFiltersOptions } from "@/constants/issue"; import { ILayoutDisplayFiltersOptions } from "@/constants/issue";
type Props = { type Props = {
displayFilters: IIssueDisplayFilterOptions; displayFilters: IIssueDisplayFilterOptions | undefined;
displayProperties: IIssueDisplayProperties; displayProperties: IIssueDisplayProperties;
handleDisplayFiltersUpdate: (updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => void; handleDisplayFiltersUpdate: (updatedDisplayFilter: Partial<IIssueDisplayFilterOptions>) => void;
handleDisplayPropertiesUpdate: (updatedDisplayProperties: Partial<IIssueDisplayProperties>) => void; handleDisplayPropertiesUpdate: (updatedDisplayProperties: Partial<IIssueDisplayProperties>) => void;
@ -80,8 +80,8 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
{/* sub-group by */} {/* sub-group by */}
{isDisplayFilterEnabled("sub_group_by") && {isDisplayFilterEnabled("sub_group_by") &&
displayFilters.group_by !== null && displayFilters?.group_by !== null &&
displayFilters.layout === "kanban" && ( displayFilters?.layout === "kanban" && (
<div className="py-2"> <div className="py-2">
<FilterSubGroupBy <FilterSubGroupBy
displayFilters={displayFilters} displayFilters={displayFilters}
@ -100,7 +100,7 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
{isDisplayFilterEnabled("order_by") && ( {isDisplayFilterEnabled("order_by") && (
<div className="py-2"> <div className="py-2">
<FilterOrderBy <FilterOrderBy
selectedOrderBy={displayFilters.order_by} selectedOrderBy={displayFilters?.order_by}
handleUpdate={(val) => handleUpdate={(val) =>
handleDisplayFiltersUpdate({ handleDisplayFiltersUpdate({
order_by: val, order_by: val,
@ -115,7 +115,7 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
{isDisplayFilterEnabled("type") && ( {isDisplayFilterEnabled("type") && (
<div className="py-2"> <div className="py-2">
<FilterIssueType <FilterIssueType
selectedIssueType={displayFilters.type} selectedIssueType={displayFilters?.type}
handleUpdate={(val) => handleUpdate={(val) =>
handleDisplayFiltersUpdate({ handleDisplayFiltersUpdate({
type: val, type: val,
@ -130,8 +130,8 @@ export const DisplayFiltersSelection: React.FC<Props> = observer((props) => {
<div className="py-2"> <div className="py-2">
<FilterExtraOptions <FilterExtraOptions
selectedExtraOptions={{ selectedExtraOptions={{
show_empty_groups: displayFilters.show_empty_groups ?? true, show_empty_groups: displayFilters?.show_empty_groups ?? true,
sub_issue: displayFilters.sub_issue ?? true, sub_issue: displayFilters?.sub_issue ?? true,
}} }}
handleUpdate={(key, val) => handleUpdate={(key, val) =>
handleDisplayFiltersUpdate({ handleDisplayFiltersUpdate({

View File

@ -8,7 +8,7 @@ import { ISSUE_GROUP_BY_OPTIONS } from "@/constants/issue";
// constants // constants
type Props = { type Props = {
displayFilters: IIssueDisplayFilterOptions; displayFilters: IIssueDisplayFilterOptions | undefined;
groupByOptions: TIssueGroupByOptions[]; groupByOptions: TIssueGroupByOptions[];
handleUpdate: (val: TIssueGroupByOptions) => void; handleUpdate: (val: TIssueGroupByOptions) => void;
ignoreGroupedFilters: Partial<TIssueGroupByOptions>[]; ignoreGroupedFilters: Partial<TIssueGroupByOptions>[];
@ -19,8 +19,8 @@ export const FilterGroupBy: React.FC<Props> = observer((props) => {
const [previewEnabled, setPreviewEnabled] = useState(true); const [previewEnabled, setPreviewEnabled] = useState(true);
const selectedGroupBy = displayFilters.group_by ?? null; const selectedGroupBy = displayFilters?.group_by ?? null;
const selectedSubGroupBy = displayFilters.sub_group_by ?? null; const selectedSubGroupBy = displayFilters?.sub_group_by ?? null;
return ( return (
<> <>
@ -32,7 +32,11 @@ export const FilterGroupBy: React.FC<Props> = observer((props) => {
{previewEnabled && ( {previewEnabled && (
<div> <div>
{ISSUE_GROUP_BY_OPTIONS.filter((option) => groupByOptions.includes(option.key)).map((groupBy) => { {ISSUE_GROUP_BY_OPTIONS.filter((option) => groupByOptions.includes(option.key)).map((groupBy) => {
if (displayFilters.layout === "kanban" && selectedSubGroupBy !== null && groupBy.key === selectedSubGroupBy) if (
displayFilters?.layout === "kanban" &&
selectedSubGroupBy !== null &&
groupBy.key === selectedSubGroupBy
)
return null; return null;
if (ignoreGroupedFilters.includes(groupBy?.key)) return null; if (ignoreGroupedFilters.includes(groupBy?.key)) return null;

View File

@ -48,7 +48,7 @@ export const ProjectAppliedFiltersList: React.FC<Props> = (props) => {
<div className="flex items-start justify-between gap-1.5"> <div className="flex items-start justify-between gap-1.5">
<div className="flex flex-wrap items-stretch gap-2 bg-custom-background-100"> <div className="flex flex-wrap items-stretch gap-2 bg-custom-background-100">
{/* Applied filters */} {/* Applied filters */}
{Object.entries(appliedFilters).map(([key, value]) => { {Object.entries(appliedFilters ?? {}).map(([key, value]) => {
const filterKey = key as keyof TProjectFilters; const filterKey = key as keyof TProjectFilters;
if (!value) return; if (!value) return;

View File

@ -197,16 +197,16 @@ export const CreateProjectForm: FC<Props> = observer((props) => {
onChange={(val: any) => { onChange={(val: any) => {
let logoValue = {}; let logoValue = {};
if (val.type === "emoji") if (val?.type === "emoji")
logoValue = { logoValue = {
value: convertHexEmojiToDecimal(val.value.unified), value: convertHexEmojiToDecimal(val.value.unified),
url: val.value.imageUrl, url: val.value.imageUrl,
}; };
else if (val.type === "icon") logoValue = val.value; else if (val?.type === "icon") logoValue = val.value;
onChange({ onChange({
in_use: val.type, in_use: val?.type,
[val.type]: logoValue, [val?.type]: logoValue,
}); });
}} }}
defaultIconColor={value.in_use && value.in_use === "icon" ? value.icon?.color : undefined} defaultIconColor={value.in_use && value.in_use === "icon" ? value.icon?.color : undefined}

View File

@ -157,16 +157,16 @@ export const ProjectDetailsForm: FC<IProjectDetailsForm> = (props) => {
onChange={(val) => { onChange={(val) => {
let logoValue = {}; let logoValue = {};
if (val.type === "emoji") if (val?.type === "emoji")
logoValue = { logoValue = {
value: convertHexEmojiToDecimal(val.value.unified), value: convertHexEmojiToDecimal(val.value.unified),
url: val.value.imageUrl, url: val.value.imageUrl,
}; };
else if (val.type === "icon") logoValue = val.value; else if (val?.type === "icon") logoValue = val.value;
onChange({ onChange({
in_use: val.type, in_use: val?.type,
[val.type]: logoValue, [val?.type]: logoValue,
}); });
}} }}
defaultIconColor={value?.in_use && value.in_use === "icon" ? value?.icon?.color : undefined} defaultIconColor={value?.in_use && value.in_use === "icon" ? value?.icon?.color : undefined}

View File

@ -59,9 +59,9 @@ const myIssuesParamsToKey = (params: any) => {
let labelsKey = labels ? labels.split(",") : []; let labelsKey = labels ? labels.split(",") : [];
const startDateKey = start_date ?? ""; const startDateKey = start_date ?? "";
const targetDateKey = target_date ?? ""; const targetDateKey = target_date ?? "";
const type = params.type ? params.type.toUpperCase() : "NULL"; const type = params?.type ? params.type.toUpperCase() : "NULL";
const groupBy = params.group_by ? params.group_by.toUpperCase() : "NULL"; const groupBy = params?.group_by ? params.group_by.toUpperCase() : "NULL";
const orderBy = params.order_by ? params.order_by.toUpperCase() : "NULL"; const orderBy = params?.order_by ? params.order_by.toUpperCase() : "NULL";
// sorting each keys in ascending order // sorting each keys in ascending order
assigneesKey = assigneesKey.sort().join("_"); assigneesKey = assigneesKey.sort().join("_");

View File

@ -152,6 +152,8 @@ export const getNumberCount = (number: number): string => {
export const objToQueryParams = (obj: any) => { export const objToQueryParams = (obj: any) => {
const params = new URLSearchParams(); const params = new URLSearchParams();
if (!obj) return params.toString();
for (const [key, value] of Object.entries(obj)) { for (const [key, value] of Object.entries(obj)) {
if (value !== undefined && value !== null) params.append(key, value as string); if (value !== undefined && value !== null) params.append(key, value as string);
} }

View File

@ -21,7 +21,6 @@ const useReloadConfirmations = (isActive = true) => {
const leave = confirm("Are you sure you want to leave? Changes you made may not be saved."); const leave = confirm("Are you sure you want to leave? Changes you made may not be saved.");
if (!leave) { if (!leave) {
router.events.emit("routeChangeError"); router.events.emit("routeChangeError");
throw `Route change to "${url}" was aborted (this error can be safely ignored).`;
} }
}, },
[isActive, showAlert, router.events] [isActive, showAlert, router.events]

View File

@ -55,7 +55,7 @@ const AppPostInstallation: NextPageWithLayout = () => {
window.close(); window.close();
}) })
.catch((err) => { .catch((err) => {
throw err.response; throw err?.response;
}); });
} }
} }