Skip to content

Commit 4f0349b

Browse files
fix: added block id to date ids to ensure unique field ids (#771)
Co-authored-by: Martina Bustacchini <41484878+deodorhunter@users.noreply.github.com>
1 parent 4661b5c commit 4f0349b

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

src/components/ItaliaTheme/Blocks/BandiSearch/Body.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
167167
<>
168168
{React.createElement(filterOne.widget.component, {
169169
...filterOne.widget?.props,
170+
blockID: id,
170171
id: 'filterOne',
171172
onChange: (filter, value) => {
172173
dispatchFilter({
@@ -180,6 +181,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
180181
{filterTwo &&
181182
React.createElement(filterTwo.widget?.component, {
182183
...filterTwo.widget?.props,
184+
blockID: id,
183185
id: 'filterTwo',
184186
onChange: (filter, value) =>
185187
dispatchFilter({
@@ -190,6 +192,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
190192
{filterThree &&
191193
React.createElement(filterThree.widget?.component, {
192194
...filterThree.widget?.props,
195+
blockID: id,
193196
id: 'filterThree',
194197
onChange: (filter, value) =>
195198
dispatchFilter({

src/components/ItaliaTheme/Blocks/Common/SearchFilters/DateFilter.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ const DateFilter = (props) => {
188188
endLabel,
189189
defaultStart,
190190
defaultEnd,
191+
blockID,
191192
...rest
192193
} = props;
193194
const { DateRangePicker } = reactDates;
@@ -230,12 +231,12 @@ const DateFilter = (props) => {
230231
<DateRangePicker
231232
{...rest}
232233
startDate={value?.startDate || defaultStart}
233-
startDateId="start-date-filter"
234+
startDateId={`start-date-filter-${blockID}`}
234235
startDatePlaceholderText={
235236
startLabel ?? intl.formatMessage(messages.eventSearchStartDate)
236237
}
237238
endDate={value?.endDate || defaultEnd}
238-
endDateId="end-date-filter"
239+
endDateId={`end-date-filter-${blockID}`}
239240
endDatePlaceholderText={
240241
endLabel ?? intl.formatMessage(messages.eventSearchEndDate)
241242
}

src/components/ItaliaTheme/Blocks/EventSearch/Body.jsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
182182
<>
183183
{React.createElement(filterOne.widget.component, {
184184
...filterOne.widget?.props,
185+
blockID: id,
185186
id: 'filterOne',
186187
onChange: (filter, value) => {
187188
dispatchFilter({
@@ -195,6 +196,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
195196
{filterTwo &&
196197
React.createElement(filterTwo.widget?.component, {
197198
...filterTwo.widget?.props,
199+
blockID: id,
198200
id: 'filterTwo',
199201
onChange: (filter, value) =>
200202
dispatchFilter({
@@ -205,6 +207,7 @@ const Body = ({ data, id, inEditMode, path, onChangeBlock }) => {
205207
{filterThree &&
206208
React.createElement(filterThree.widget?.component, {
207209
...filterThree.widget?.props,
210+
blockID: id,
208211
id: 'filterThree',
209212
onChange: (filter, value) =>
210213
dispatchFilter({

0 commit comments

Comments
 (0)