Skip to content

Commit

Permalink
Merge branch 'main' into tests-for-setting-balance-and-exporting-gift…
Browse files Browse the repository at this point in the history
…-cards
  • Loading branch information
karola312 authored Mar 15, 2024
2 parents a06cb48 + cac7189 commit db23b91
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-pets-bathe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Fix "TypeError: Cannot read properties of undefined (reading '0')" error thrown by datagrid by stop propagating events from RadioGroup component in ChannelsAvailability. RadioGroup fires couple events at onec and datagrid listing to global onClick event, that cause error in datagrid.
5 changes: 5 additions & 0 deletions .changeset/funny-rabbits-walk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Add "ResizeObserver loop limit exceeded" to ignored in Sentry. Error is thrown only during Cypress tests that will be soon migrated and we could remove error from ignored.
5 changes: 5 additions & 0 deletions .changeset/wicked-scissors-fold.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": patch
---

Add "ResizeObserver loop completed with undelivered notifications" to ignored in Sentry.
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
// @ts-strict-ignore
import { ChannelData } from "@dashboard/channels/utils";
import { RadioGroup } from "@dashboard/components/RadioGroup";
import useCurrentDate from "@dashboard/hooks/useCurrentDate";
import useDateLocalize from "@dashboard/hooks/useDateLocalize";
import { getFormErrors, getProductErrorMessage } from "@dashboard/utils/errors";
import { TextField } from "@material-ui/core";
import {
Box,
Checkbox,
Divider,
RadioGroup,
Text,
} from "@saleor/macaw-ui-next";
import { Box, Checkbox, Divider, Text } from "@saleor/macaw-ui-next";
import React, { useState } from "react";
import { useIntl } from "react-intl";

Expand Down
22 changes: 22 additions & 0 deletions src/components/RadioGroup/RadioGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import {
RadioGroup as RadioGroupBase,
RadioGroupRootProps,
} from "@saleor/macaw-ui-next";
import React from "react";

import { StopPropagation } from "../StopPropagation";

const RadioGroupRoot = (props: RadioGroupRootProps) => {
// StopProgation is used here to block onClick events from RadioGroup that cause throw error in datagrid
// Datagrid listing for all on click event but RadioGroup emitated couple events at onced
// Radix issue: https://github.com/radix-ui/primitives/issues/1982
return (
<StopPropagation>
<RadioGroupBase {...props} />
</StopPropagation>
);
};

export const RadioGroup = Object.assign(RadioGroupRoot, {
Item: RadioGroupBase.Item,
});
1 change: 1 addition & 0 deletions src/components/RadioGroup/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./RadioGroup";
12 changes: 12 additions & 0 deletions src/components/StopPropagation/StopPropagation.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React, { ReactNode } from "react";

interface StopPropagationProps {
children: ReactNode;
}

// If you don't want to click events bubble in the DOM tree, you can use this component.
export const StopPropagation = ({ children }: StopPropagationProps) => {
const stopPropagation = (e: React.MouseEvent) => e.stopPropagation();

return <div onClick={stopPropagation}>{children}</div>;
};
1 change: 1 addition & 0 deletions src/components/StopPropagation/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from "./StopPropagation";
7 changes: 6 additions & 1 deletion src/services/errorTracking/adapters/Sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ export const SentryAdapter = (config: Config): TrackerMethods => {
Sentry.init({
dsn: config.dsn,
environment: config.environment,
ignoreErrors: ["Editor's content can not be saved in read-only mode"],
ignoreErrors: [
"Editor's content can not be saved in read-only mode",
"ResizeObserver loop completed with undelivered notifications",
// TODO: rmoeve after Cypress migation
"ResizeObserver loop limit exceeded",
],
});
return true;
}
Expand Down

0 comments on commit db23b91

Please sign in to comment.