Skip to content

Commit

Permalink
fix: added block id to date ids to ensure unique field ids (#771)
Browse files Browse the repository at this point in the history
Co-authored-by: Martina Bustacchini <[email protected]>
  • Loading branch information
sabrina-bongiovanni and deodorhunter authored Sep 17, 2024
1 parent 4661b5c commit 4f0349b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
<>
{React.createElement(filterOne.widget.component, {
...filterOne.widget?.props,
blockID: id,
id: 'filterOne',
onChange: (filter, value) => {
dispatchFilter({
Expand All @@ -180,6 +181,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
{filterTwo &&
React.createElement(filterTwo.widget?.component, {
...filterTwo.widget?.props,
blockID: id,
id: 'filterTwo',
onChange: (filter, value) =>
dispatchFilter({
Expand All @@ -190,6 +192,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
{filterThree &&
React.createElement(filterThree.widget?.component, {
...filterThree.widget?.props,
blockID: id,
id: 'filterThree',
onChange: (filter, value) =>
dispatchFilter({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ const DateFilter = (props) => {
endLabel,
defaultStart,
defaultEnd,
blockID,
...rest
} = props;
const { DateRangePicker } = reactDates;
Expand Down Expand Up @@ -230,12 +231,12 @@ const DateFilter = (props) => {
<DateRangePicker
{...rest}
startDate={value?.startDate || defaultStart}
startDateId="start-date-filter"
startDateId={`start-date-filter-${blockID}`}
startDatePlaceholderText={
startLabel ?? intl.formatMessage(messages.eventSearchStartDate)
}
endDate={value?.endDate || defaultEnd}
endDateId="end-date-filter"
endDateId={`end-date-filter-${blockID}`}
endDatePlaceholderText={
endLabel ?? intl.formatMessage(messages.eventSearchEndDate)
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ItaliaTheme/Blocks/EventSearch/Body.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
<>
{React.createElement(filterOne.widget.component, {
...filterOne.widget?.props,
blockID: id,
id: 'filterOne',
onChange: (filter, value) => {
dispatchFilter({
Expand All @@ -195,6 +196,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
{filterTwo &&
React.createElement(filterTwo.widget?.component, {
...filterTwo.widget?.props,
blockID: id,
id: 'filterTwo',
onChange: (filter, value) =>
dispatchFilter({
Expand All @@ -205,6 +207,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
{filterThree &&
React.createElement(filterThree.widget?.component, {
...filterThree.widget?.props,
blockID: id,
id: 'filterThree',
onChange: (filter, value) =>
dispatchFilter({
Expand Down

0 comments on commit 4f0349b

Please sign in to comment.