-
Notifications
You must be signed in to change notification settings - Fork 1
LPD-70790 Implement FDS search management through global state #5187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
CI is automatically triggering the following test suites:
|
|
Test suite sf has been triggered on http://test-1-27 |
| public String getCollectionKey() { | ||
| return "sample"; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are adding new collection in this PR, along with lang key.
| @Override | ||
| public String getKey() { | ||
| return "search-fds-sample"; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the key part of fragment configuration to wire API generation in tests.
| _reactRenderer.renderReact( | ||
| new ComponentDescriptor( | ||
| "{Search} from frontend-data-set-sample-web"), | ||
| new HashMap<>(), httpServletRequest, printWriter); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why this does not render in edit mode of the fragment. I tried wrapping it in div, but it makes no difference. It still renders correctly after it's published.
✔️ ci:test:sf - 1 out of 1 jobs passed in 4 minutesRan com.liferay.source.formatter at released version 1.0.1550. Click here for more details.Base Branch:Branch Name: master Sender Branch:Branch Name: LPD-70790 1 Successful Jobs:For more details click here. |
|
Jenkins Build:test-portal-source-format#8780 Jenkins Report:jenkins-report.html Jenkins Suite:sf Pull Request:liferay-frontend#5187 Testray Routine:EE Pull Request Testray Build ID: 360648418Testray Importer:test-portal-source-format#8780 |
| const [advancedSearchQueryValue, setAdvancedSearchQueryValue] = | ||
| useLiferayState<ISearchQuery>(advancedSearchQueryAtom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the proper way of wiring, through imported atom. With this everything works, so it is something I think we can promote.
I intended to add additional sample for unsafe method, but there is complication with it. Fragment -> FDS setting works fine, but for FDS -> fragment setting FDS needs to have two ways of operating (one safe, one unsafe). We can do this if there is a product need, but I don't think we can omit it for now.
| const advancedSearchQueryAtom = State.atom<ISearchQuery>( | ||
| 'advancedSearchQuery', | ||
| { | ||
| query: '', | ||
| } | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For value of the atom we could have a string value, instead of an object. But I think it's wise to have object right away, to make future changes non-breaking.
| atoms: { | ||
| searchQuery: advancedSearchQueryAtom, | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New API for FrontendDataSet, settable here in propsTransformer. This allows atom import and type safety.
| apiURL, | ||
| appURL, | ||
| firstRender, | ||
| globalSearchQueryValue.query, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On different events in FDS, we no longer set search state, only global search state. This useEffect is the only place that sets internal state, when global state changes.
|
|
||
| useEffect(() => { | ||
| if (firstRender) { | ||
| const urlConfig = readConfigFromURL(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using getSearchParam() here, but it was causing an endless loop, since it's recreated on each render.
I honestly prefer calling util like this directly, instead of going through hook. I think it makes code a lot easier to read.
| pageDefinition: getPageDefinition([ | ||
| ...fragmentKeys.map((fragmentKey) => | ||
| getFragmentDefinition({ | ||
| id: getRandomString(), | ||
| key: fragmentKey, | ||
| }) | ||
| ), | ||
| getWidgetDefinition({ | ||
| id: getRandomString(), | ||
| widgetName: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New API to add an array of fragments to page. Idea is to have multiple fragments for other global states.
| await waitForFDS({page, visualizationMode: EFDSVisualizationMode.TABLE}); | ||
| }); | ||
|
|
||
| test('Check Search clear button', async ({fdsSamplePage}) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I merged this test with the other, for performance. No changes in logic.
|
ci:test:relevant |
|
Test suite relevant has been triggered on http://test-1-32 |
❌ ci:test:stable - 7 out of 12 jobs passed❌ ci:test:relevant - 10 out of 19 jobs passed in 2 hours 13 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: 6a7bfb2107b8f36d6e92705ecec7ea637f3efca5 ci:test:stable - 7 out of 12 jobs PASSED5 Failed Jobs:
7 Successful Jobs:ci:test:relevant - 10 out of 19 jobs PASSED9 Failed Jobs:
10 Successful Jobs:For more details click here.Failures unique to this pull:
Test bundle downloads: |
|
Jenkins Build:test-portal-acceptance-pullrequest(master)#8701 Jenkins Report:jenkins-report.html Jenkins Suite:relevant Pull Request:liferay-frontend#5187 Testray Routine:EE Pull Request Testray Build:[master] ci:test:relevant - markocikos > liferay-frontend - PR#5187 - 2025-11-06[04:40:19] Testray Build ID: 360713493Testray Importer:test-portal-acceptance-pullrequest(master)#8701 |
3d6339a to
871b895
Compare
|
ci:test:relevant |
|
Test suite relevant has been triggered on http://test-1-33 |
❌ ci:test:stable - 9 out of 12 jobs passed❌ ci:test:relevant - 12 out of 19 jobs passed in 2 hours 16 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: 1e2ce4c3a8e6d539ab2c7a723e8277a9d4ebe991 ci:test:stable - 9 out of 12 jobs PASSED3 Failed Jobs:
9 Successful Jobs:ci:test:relevant - 12 out of 19 jobs PASSED7 Failed Jobs:
12 Successful Jobs:For more details click here.Failures unique to this pull:
For upstream results, click here.Test bundle downloads: |
|
Jenkins Build:test-portal-acceptance-pullrequest(master)#8705 Jenkins Report:jenkins-report.html Jenkins Suite:relevant Pull Request:liferay-frontend#5187 Testray Routine:EE Pull Request Testray Build:[master] ci:test:relevant - markocikos > liferay-frontend - PR#5187 - 2025-11-10[09:42:31] Testray Build ID: 363538137Testray Importer:test-portal-acceptance-pullrequest(master)#8705 |
|
ci:test:relevant |
|
Test suite relevant has been triggered on http://test-1-27 |
❌ ci:test:stable - 9 out of 12 jobs passed❌ ci:test:relevant - 12 out of 19 jobs passed in 2 hours 14 minutesClick here for more details.Base Branch:Branch Name: master Upstream Comparison:Branch GIT ID: e78e0629309887903e2b29cf9a78fb3e19b72915 ci:test:stable - 9 out of 12 jobs PASSED3 Failed Jobs:
9 Successful Jobs:ci:test:relevant - 12 out of 19 jobs PASSED7 Failed Jobs:
12 Successful Jobs:For more details click here.Failures unique to this pull:
For upstream results, click here.Test bundle downloads: |
|
Jenkins Build:test-portal-acceptance-pullrequest(master)#15485 Jenkins Report:jenkins-report.html Jenkins Suite:relevant Pull Request:liferay-frontend#5187 Testray Routine:EE Pull Request Testray Build:[master] ci:test:relevant - markocikos > liferay-frontend - PR#5187 - 2025-11-11[02:20:29] Testray Build ID: 364272656Testray Importer:test-portal-acceptance-pullrequest(master)#15485 |
|
Followup in #5213 |

References
What is the goal of this PR?
With this PR, FDS manages search though global state. This enables JS code from any other part of the page to interact with it. In PR, we are adding a fragment sample that showcases this wiring.
See technical notes inline.
What does it look like?
vokoscreenNG-2025-11-06_12-38-17.mp4