From d37281d13dcf5aeb63ec8af2ba8e7e052a21818c Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:10:10 +0300 Subject: [PATCH 01/19] Update withSearch.jsx --- src/components/manage/Blocks/Search/hocs/withSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/manage/Blocks/Search/hocs/withSearch.jsx b/src/components/manage/Blocks/Search/hocs/withSearch.jsx index 54d9570131..70bfb5b47b 100644 --- a/src/components/manage/Blocks/Search/hocs/withSearch.jsx +++ b/src/components/manage/Blocks/Search/hocs/withSearch.jsx @@ -328,7 +328,7 @@ const withSearch = (options) => (WrappedComponent) => { if (toSearchFacets) setFacets(toSearchFacets); if (toSortOn) setSortOn(toSortOn); if (toSortOrder) setSortOrder(toSortOrder); - setSearchData(searchData); + //setSearchData(searchData); setLocationSearchData(getSearchFields(searchData)); }, toSearchFacets ? inputDelay / 3 : inputDelay, From 5e69b51d260ce88c713052698dc4b61ea384174f Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 12:12:16 +0300 Subject: [PATCH 02/19] Create 5262.fix --- news/5262.fix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/5262.fix diff --git a/news/5262.fix b/news/5262.fix new file mode 100644 index 0000000000..523a8c65b5 --- /dev/null +++ b/news/5262.fix @@ -0,0 +1 @@ +fix search block state on edit @dobri1408 From fdb633ad399988b34875d0253fab588682e2b6db Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:09:59 +0300 Subject: [PATCH 03/19] Update SearchBlockEdit.jsx --- src/components/manage/Blocks/Search/SearchBlockEdit.jsx | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index 0a3f222e9b..53b0d454db 100644 --- a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -59,11 +59,6 @@ const SearchBlockEdit = (props) => { }; const { query = {} } = data || {}; - // We don't need deep compare here, as this is just json serializable data. - const deepQuery = JSON.stringify(query); - useEffect(() => { - onTriggerSearch(); - }, [deepQuery, onTriggerSearch]); return ( <> From 7c24c5fb0e44cbc8f1b704c08d7cc5bc96d0f864 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 14:10:26 +0300 Subject: [PATCH 04/19] Update withSearch.jsx --- src/components/manage/Blocks/Search/hocs/withSearch.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/manage/Blocks/Search/hocs/withSearch.jsx b/src/components/manage/Blocks/Search/hocs/withSearch.jsx index 70bfb5b47b..54d9570131 100644 --- a/src/components/manage/Blocks/Search/hocs/withSearch.jsx +++ b/src/components/manage/Blocks/Search/hocs/withSearch.jsx @@ -328,7 +328,7 @@ const withSearch = (options) => (WrappedComponent) => { if (toSearchFacets) setFacets(toSearchFacets); if (toSortOn) setSortOn(toSortOn); if (toSortOrder) setSortOrder(toSortOrder); - //setSearchData(searchData); + setSearchData(searchData); setLocationSearchData(getSearchFields(searchData)); }, toSearchFacets ? inputDelay / 3 : inputDelay, From 0830a3bd94d8f7e9b5dcfb1d5b5a13e5a3d3cdbd Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:27:45 +0300 Subject: [PATCH 05/19] Update SearchBlockEdit.jsx --- src/components/manage/Blocks/Search/SearchBlockEdit.jsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index 53b0d454db..4ec828c1cc 100644 --- a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -1,4 +1,4 @@ -import React, { useEffect } from 'react'; +import React from 'react'; import { defineMessages } from 'react-intl'; import { compose } from 'redux'; @@ -26,7 +26,6 @@ const SearchBlockEdit = (props) => { data, selected, intl, - onTriggerSearch, querystring = {}, } = props; const { sortable_indexes = {} } = querystring; @@ -58,8 +57,6 @@ const SearchBlockEdit = (props) => { ]), }; - const { query = {} } = data || {}; - return ( <> Date: Tue, 3 Oct 2023 15:32:08 +0300 Subject: [PATCH 06/19] Delete news/5262.fix --- news/5262.fix | 1 - 1 file changed, 1 deletion(-) delete mode 100644 news/5262.fix diff --git a/news/5262.fix b/news/5262.fix deleted file mode 100644 index 523a8c65b5..0000000000 --- a/news/5262.fix +++ /dev/null @@ -1 +0,0 @@ -fix search block state on edit @dobri1408 From e38dcc88451ff2ceb4c50a00bb909b25fb6426b1 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 3 Oct 2023 15:32:26 +0300 Subject: [PATCH 07/19] Create 5262.bugfix --- news/5262.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/5262.bugfix diff --git a/news/5262.bugfix b/news/5262.bugfix new file mode 100644 index 0000000000..523a8c65b5 --- /dev/null +++ b/news/5262.bugfix @@ -0,0 +1 @@ +fix search block state on edit @dobri1408 From 0814c59fb3f3adb73648b4c74a01edb42cd642e6 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Mon, 26 Feb 2024 19:57:48 +0200 Subject: [PATCH 08/19] fix conflict --- src/components/manage/Blocks/Search/SearchBlockEdit.jsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index 4ec828c1cc..37e9934f43 100644 --- a/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -26,6 +26,8 @@ const SearchBlockEdit = (props) => { data, selected, intl, + navRoot, + contentType, querystring = {}, } = props; const { sortable_indexes = {} } = querystring; @@ -75,6 +77,8 @@ const SearchBlockEdit = (props) => { }} onChangeBlock={onChangeBlock} formData={data} + navRoot={navRoot} + contentType={contentType} /> From 12d0836626736e38b425aaa42ae767780f3f79e4 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Tue, 27 Feb 2024 15:56:43 +0200 Subject: [PATCH 09/19] make sort order and sort on work on edit --- .../manage/Blocks/Search/SearchBlockEdit.jsx | 15 ++++++++++++++- pnpm-lock.yaml | 1 + 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index 37e9934f43..c73c535357 100644 --- a/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -1,4 +1,4 @@ -import React from 'react'; +import React, { useEffect } from 'react'; import { defineMessages } from 'react-intl'; import { compose } from 'redux'; @@ -28,6 +28,7 @@ const SearchBlockEdit = (props) => { intl, navRoot, contentType, + onTriggerSearch, querystring = {}, } = props; const { sortable_indexes = {} } = querystring; @@ -59,6 +60,18 @@ const SearchBlockEdit = (props) => { ]), }; + const { query = {} } = data || {}; + // We don't need deep compare here, as this is just json serializable data. + const deepQuery = JSON.stringify(query); + useEffect(() => { + onTriggerSearch( + '', + data?.facets, + data?.query?.sort_on, + data?.query?.sort_order, + ); + }, [deepQuery, onTriggerSearch, data]); + return ( <> Date: Tue, 27 Feb 2024 16:00:36 +0200 Subject: [PATCH 10/19] Update pnpm-lock.yaml --- pnpm-lock.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d737fe9fae..d4a23e2f1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35866,7 +35866,6 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 prop-types: 15.7.2 - bundledDependencies: false /react@17.0.2: resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} From d050b186c89f67e820ea228e1ea7952f16bf5897 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Tue, 27 Feb 2024 17:53:05 +0200 Subject: [PATCH 11/19] changelog --- news/5262.bugfix | 1 - packages/volto/news/5262.bugfix | 1 + pnpm-lock.yaml | 3 +-- 3 files changed, 2 insertions(+), 3 deletions(-) delete mode 100644 news/5262.bugfix create mode 100644 packages/volto/news/5262.bugfix diff --git a/news/5262.bugfix b/news/5262.bugfix deleted file mode 100644 index 523a8c65b5..0000000000 --- a/news/5262.bugfix +++ /dev/null @@ -1 +0,0 @@ -fix search block state on edit @dobri1408 diff --git a/packages/volto/news/5262.bugfix b/packages/volto/news/5262.bugfix new file mode 100644 index 0000000000..8648d6af38 --- /dev/null +++ b/packages/volto/news/5262.bugfix @@ -0,0 +1 @@ +(fix): make search block sort and facets work on edit @dobri1408 \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d737fe9fae..e0e7a1d4d4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35866,7 +35866,6 @@ packages: loose-envify: 1.4.0 object-assign: 4.1.1 prop-types: 15.7.2 - bundledDependencies: false /react@17.0.2: resolution: {integrity: sha512-gnhPt75i/dq/z3/6q/0asP78D0u592D5L1pd7M8P+dck6Fu/jJeL6iVVK23fptSUZj8Vjf++7wXA8UNclGQcbA==} @@ -42298,4 +42297,4 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} - dev: true + dev: true \ No newline at end of file From 1df5b117b5b77b891d4f47430841f6763b231918 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Tue, 27 Feb 2024 20:24:37 +0200 Subject: [PATCH 12/19] add cypress test --- cypress.config.ts | 7 +++ cypress/fixtures/example.json | 5 ++ cypress/support/commands.ts | 37 ++++++++++++ cypress/support/e2e.ts | 20 +++++++ .../tests/core/blocks/blocks-search.js | 58 +++++++++++++++++++ 5 files changed, 127 insertions(+) create mode 100644 cypress.config.ts create mode 100644 cypress/fixtures/example.json create mode 100644 cypress/support/commands.ts create mode 100644 cypress/support/e2e.ts diff --git a/cypress.config.ts b/cypress.config.ts new file mode 100644 index 0000000000..8959a4f250 --- /dev/null +++ b/cypress.config.ts @@ -0,0 +1,7 @@ +export default { + e2e: { + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, +}; diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json new file mode 100644 index 0000000000..02e4254378 --- /dev/null +++ b/cypress/fixtures/example.json @@ -0,0 +1,5 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io", + "body": "Fixtures are a great way to mock data for responses to routes" +} diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts new file mode 100644 index 0000000000..698b01a42c --- /dev/null +++ b/cypress/support/commands.ts @@ -0,0 +1,37 @@ +/// +// *********************************************** +// This example commands.ts shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** +// +// +// -- This is a parent command -- +// Cypress.Commands.add('login', (email, password) => { ... }) +// +// +// -- This is a child command -- +// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) +// +// declare global { +// namespace Cypress { +// interface Chainable { +// login(email: string, password: string): Chainable +// drag(subject: string, options?: Partial): Chainable +// dismiss(subject: string, options?: Partial): Chainable +// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable +// } +// } +// } \ No newline at end of file diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts new file mode 100644 index 0000000000..f80f74f8e1 --- /dev/null +++ b/cypress/support/e2e.ts @@ -0,0 +1,20 @@ +// *********************************************************** +// This example support/e2e.ts is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands' + +// Alternatively you can use CommonJS syntax: +// require('./commands') \ No newline at end of file diff --git a/packages/volto/cypress/tests/core/blocks/blocks-search.js b/packages/volto/cypress/tests/core/blocks/blocks-search.js index 9574b1b6d2..377a123cfb 100644 --- a/packages/volto/cypress/tests/core/blocks/blocks-search.js +++ b/packages/volto/cypress/tests/core/blocks/blocks-search.js @@ -497,4 +497,62 @@ describe('Search Block Tests', () => { `Search results: ${results_number}`, ); }); + + it('Search block - test on edit sort on and sort order', () => { + cy.visit('/'); + cy.get('#toolbar-add > .icon').click(); + cy.get('#toolbar-add-document').click(); + cy.getSlateTitle().focus().click().type('My Search Page'); + + // Add Search listing block + cy.addNewBlock('search'); + + // Add search query criteria + cy.get('#default-query-0-query .react-select__value-container').click(); + cy.get('#default-query-0-query .react-select__option') + .contains('Type') + .click(); + + cy.get('#default-query-0-query .fields:first-of-type > .field').click(); + cy.get( + '#default-query-0-query .fields:first-of-type > .field .react-select__option', + ) + .contains('Page') + .click(); + + cy.get('#default-query-0-query .fields:first-of-type > .field').click(); + cy.get( + '#default-query-0-query .fields:first-of-type > .field .react-select__option', + ) + .contains('Folder') + .click(); + + cy.get('#default-query-0-query .fields:first-of-type > .field').click(); + cy.get( + '#default-query-0-query .fields:first-of-type > .field .react-select__option', + ) + .contains('Event') + .click(); + + // uncheck showSearchButton + cy.get('label[for=field-showSearchButton]').click(); + cy.get('.search-wrapper .ui.button').should('contain', 'Search'); + // reverse order + cy.get('label[for=field-sort_order_boolean-2-query]').click(); + //check if the sorting order is working + cy.get('.listing-item').first().contains('My Event'); + cy.get('#select-listingblock-sort-on').click(); + cy.get('.react-select__menu .react-select__group') + .first() + .children() + .first() + .next() + .children() + .first() + .next() + .click(); + cy.wait(5000); + + cy.get('.listing-item').first().contains('My page'); + }); }); From 3aea76397b6b8091f8a2125bc279f0341387a7aa Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:25:57 +0200 Subject: [PATCH 13/19] Delete cypress.config.ts --- cypress.config.ts | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 cypress.config.ts diff --git a/cypress.config.ts b/cypress.config.ts deleted file mode 100644 index 8959a4f250..0000000000 --- a/cypress.config.ts +++ /dev/null @@ -1,7 +0,0 @@ -export default { - e2e: { - setupNodeEvents(on, config) { - // implement node event listeners here - }, - }, -}; From 779ce77c2fc85e034649340dfa3e9628e4840b94 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:26:08 +0200 Subject: [PATCH 14/19] Delete cypress/fixtures/example.json --- cypress/fixtures/example.json | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 cypress/fixtures/example.json diff --git a/cypress/fixtures/example.json b/cypress/fixtures/example.json deleted file mode 100644 index 02e4254378..0000000000 --- a/cypress/fixtures/example.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "name": "Using fixtures to represent data", - "email": "hello@cypress.io", - "body": "Fixtures are a great way to mock data for responses to routes" -} From 4a185126c5494c748da8a0bb5e72bc7c22d18136 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:26:15 +0200 Subject: [PATCH 15/19] Delete cypress/support/commands.ts --- cypress/support/commands.ts | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 cypress/support/commands.ts diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts deleted file mode 100644 index 698b01a42c..0000000000 --- a/cypress/support/commands.ts +++ /dev/null @@ -1,37 +0,0 @@ -/// -// *********************************************** -// This example commands.ts shows you how to -// create various custom commands and overwrite -// existing commands. -// -// For more comprehensive examples of custom -// commands please read more here: -// https://on.cypress.io/custom-commands -// *********************************************** -// -// -// -- This is a parent command -- -// Cypress.Commands.add('login', (email, password) => { ... }) -// -// -// -- This is a child command -- -// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) -// -// -// -- This is a dual command -- -// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) -// -// -// -- This will overwrite an existing command -- -// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) -// -// declare global { -// namespace Cypress { -// interface Chainable { -// login(email: string, password: string): Chainable -// drag(subject: string, options?: Partial): Chainable -// dismiss(subject: string, options?: Partial): Chainable -// visit(originalFn: CommandOriginalFn, url: string, options: Partial): Chainable -// } -// } -// } \ No newline at end of file From f21338b87ffd6437648a86ead150fb02ee48b818 Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:26:25 +0200 Subject: [PATCH 16/19] Delete cypress/support/e2e.ts --- cypress/support/e2e.ts | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 cypress/support/e2e.ts diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts deleted file mode 100644 index f80f74f8e1..0000000000 --- a/cypress/support/e2e.ts +++ /dev/null @@ -1,20 +0,0 @@ -// *********************************************************** -// This example support/e2e.ts is processed and -// loaded automatically before your test files. -// -// This is a great place to put global configuration and -// behavior that modifies Cypress. -// -// You can change the location of this file or turn off -// automatically serving support files with the -// 'supportFile' configuration option. -// -// You can read more here: -// https://on.cypress.io/configuration -// *********************************************************** - -// Import commands.js using ES2015 syntax: -import './commands' - -// Alternatively you can use CommonJS syntax: -// require('./commands') \ No newline at end of file From 6ae818d979031434282dceadfa7247f42dd10bba Mon Sep 17 00:00:00 2001 From: dobri1408 <50819975+dobri1408@users.noreply.github.com> Date: Tue, 27 Feb 2024 20:27:02 +0200 Subject: [PATCH 17/19] Update pnpm-lock.yaml --- pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e0e7a1d4d4..d4a23e2f1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42297,4 +42297,4 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} - dev: true \ No newline at end of file + dev: true From 1348b202f99d7cc807240b1e0e91892bafa1913a Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Wed, 28 Feb 2024 09:38:38 +0200 Subject: [PATCH 18/19] fix tests --- packages/volto/cypress/tests/core/blocks/blocks-search.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/volto/cypress/tests/core/blocks/blocks-search.js b/packages/volto/cypress/tests/core/blocks/blocks-search.js index 377a123cfb..3867349870 100644 --- a/packages/volto/cypress/tests/core/blocks/blocks-search.js +++ b/packages/volto/cypress/tests/core/blocks/blocks-search.js @@ -554,5 +554,8 @@ describe('Search Block Tests', () => { cy.wait(5000); cy.get('.listing-item').first().contains('My page'); + //save page + cy.get('#toolbar-save > .icon').click(); + cy.wait(500); }); }); From 8bc5c869c7f4581775e0681c199db89d3a6b3cb5 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Tue, 12 Mar 2024 08:01:31 +0200 Subject: [PATCH 19/19] make option No Selection to work on edit --- .../src/components/manage/Blocks/Search/SearchBlockEdit.jsx | 1 + .../src/components/manage/Blocks/Search/hocs/withSearch.jsx | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx b/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx index c73c535357..2fbe1ce4c0 100644 --- a/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx +++ b/packages/volto/src/components/manage/Blocks/Search/SearchBlockEdit.jsx @@ -63,6 +63,7 @@ const SearchBlockEdit = (props) => { const { query = {} } = data || {}; // We don't need deep compare here, as this is just json serializable data. const deepQuery = JSON.stringify(query); + useEffect(() => { onTriggerSearch( '', diff --git a/packages/volto/src/components/manage/Blocks/Search/hocs/withSearch.jsx b/packages/volto/src/components/manage/Blocks/Search/hocs/withSearch.jsx index d06c5bc7ba..961df207b5 100644 --- a/packages/volto/src/components/manage/Blocks/Search/hocs/withSearch.jsx +++ b/packages/volto/src/components/manage/Blocks/Search/hocs/withSearch.jsx @@ -404,12 +404,12 @@ const withSearch = (options) => (WrappedComponent) => { query: data.query || {}, facets: toSearchFacets || facets, searchText: toSearchText ? toSearchText.trim() : '', - sortOn: toSortOn || sortOn, + sortOn: toSortOn || undefined, sortOrder: toSortOrder || sortOrder, facetSettings, }); if (toSearchFacets) setFacets(toSearchFacets); - if (toSortOn) setSortOn(toSortOn); + if (toSortOn) setSortOn(toSortOn || undefined); if (toSortOrder) setSortOrder(toSortOrder); setSearchData(newSearchData); setLocationSearchData(getSearchFields(newSearchData));