Skip to content

Conversation

@markocikos
Copy link
Collaborator

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
image

@markocikos markocikos requested a review from dsanz November 6, 2025 12:17
@markocikos markocikos self-assigned this Nov 6, 2025
@liferay-continuous-integration
Copy link
Collaborator

CI is automatically triggering the following test suites:

  •     ci:test:sf

@liferay-continuous-integration
Copy link
Collaborator

Test suite sf has been triggered on http://test-1-27

Comment on lines +32 to +34
public String getCollectionKey() {
return "sample";
}
Copy link
Collaborator Author

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.

Comment on lines +41 to +44
@Override
public String getKey() {
return "search-fds-sample";
}
Copy link
Collaborator Author

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.

Comment on lines +60 to +63
_reactRenderer.renderReact(
new ComponentDescriptor(
"{Search} from frontend-data-set-sample-web"),
new HashMap<>(), httpServletRequest, printWriter);
Copy link
Collaborator Author

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.

@liferay-continuous-integration
Copy link
Collaborator

✔️ ci:test:sf - 1 out of 1 jobs passed in 4 minutes

Ran com.liferay.source.formatter at released version 1.0.1550.

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 39c069ef0049e345201bfada8433901f4ce976d3

Sender Branch:

Branch Name: LPD-70790
Branch GIT ID: 3d6339afcad3d76e137b815796b305e1bb0fad43

1 out of 1 jobs PASSED
1 Successful Jobs:
For more details click here.

@liferay-continuous-integration
Copy link
Collaborator

Comment on lines +16 to +17
const [advancedSearchQueryValue, setAdvancedSearchQueryValue] =
useLiferayState<ISearchQuery>(advancedSearchQueryAtom);
Copy link
Collaborator Author

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.

Comment on lines +9 to +14
const advancedSearchQueryAtom = State.atom<ISearchQuery>(
'advancedSearchQuery',
{
query: '',
}
);
Copy link
Collaborator Author

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.

Comment on lines +126 to +128
atoms: {
searchQuery: advancedSearchQueryAtom,
},
Copy link
Collaborator Author

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,
Copy link
Collaborator Author

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);
Copy link
Collaborator Author

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.

Comment on lines +355 to +364
pageDefinition: getPageDefinition([
...fragmentKeys.map((fragmentKey) =>
getFragmentDefinition({
id: getRandomString(),
key: fragmentKey,
})
),
getWidgetDefinition({
id: getRandomString(),
widgetName:
Copy link
Collaborator Author

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}) => {
Copy link
Collaborator Author

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.

@markocikos
Copy link
Collaborator Author

ci:test:relevant

@liferay-continuous-integration
Copy link
Collaborator

Test suite relevant has been triggered on http://test-1-32

@liferay-continuous-integration
Copy link
Collaborator

❌ ci:test:stable - 7 out of 12 jobs passed

❌ ci:test:relevant - 10 out of 19 jobs passed in 2 hours 13 minutes

Click here for more details.

Base Branch:

Branch Name: master
Branch GIT ID: 39c069ef0049e345201bfada8433901f4ce976d3

Upstream Comparison:

Branch GIT ID: 6a7bfb2107b8f36d6e92705ecec7ea637f3efca5
Jenkins Build URL: EE Development Acceptance (master) - 215 - 2025-10-28[16:40:30]

ci:test:stable - 7 out of 12 jobs PASSED
7 Successful Jobs:
    ci:test:relevant - 10 out of 19 jobs PASSED

    9 Failed Jobs:

    10 Successful Jobs:
      For more details click here.

      Failures unique to this pull:

      1. js-unit/0/0
        Build was aborted
      2. js-unit/1/0
        Build was aborted
      3. modules-integration-postgresql163_stable/0/0
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
          at org.apache.tools.ant.Task.perform(Task.java:350)
          at java.util.Vector.forEach(Vector.java:1277)
          at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
          at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:217)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
          at org.apache.tools.ant.TaskAdapter.execute(TaskAdapter.java:155)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
          at org.apache.tools.ant.Task.perform(Task.java:350)
          at java.util.Vector.forEach(Vector.java:1277)
          at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:67)
          at net.sf.antcontrib.logic.TryCatchTask\$CatchBlock.execute(TryCatchTask.java:137)
          at net.sf.antcontrib.logic.TryCatchTask.execute(TryCatchTask.java:225)
          at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:299)
          at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:99)
          at org.apache.tools.ant.Task.perform(Task.java:350)
          at org.apache.tools.ant.Target.execute(Target.java:449)
          at org.apache.tools.ant.Target.performTasks(Target.java:470)
          at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1401)
          at org.apache.tools.ant.Project.executeTarget(Project.java:1374)
          at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
          at org.apache.tools.ant.Project.executeTargets(Project.java:1264)
          at org.apache.tools.ant.Main.runBuild(Main.java:818)
          at org.apache.tools.ant.Main.startAnt(Main.java:223)
          at org.apache.tools.ant.launch.Launcher.run(Launcher.java:284)
          at org.apache.tools.ant.launch.Launcher.main(Launcher.java:101)
      4. ...
      Test bundle downloads:

      @liferay-continuous-integration
      Copy link
      Collaborator

      @markocikos
      Copy link
      Collaborator Author

      I'm not sure why CI is failing so much, seems good for me locally

      image

      @markocikos
      Copy link
      Collaborator Author

      ci:test:relevant

      @liferay-continuous-integration
      Copy link
      Collaborator

      Test suite relevant has been triggered on http://test-1-33

      @liferay-continuous-integration
      Copy link
      Collaborator

      ❌ ci:test:stable - 9 out of 12 jobs passed

      ❌ ci:test:relevant - 12 out of 19 jobs passed in 2 hours 16 minutes

      Click here for more details.

      Base Branch:

      Branch Name: master
      Branch GIT ID: 9c6359f5e5e5ff20ee7eb807d2d206c3f6aabcc7

      Upstream Comparison:

      Branch GIT ID: 1e2ce4c3a8e6d539ab2c7a723e8277a9d4ebe991
      Jenkins Build URL: EE Development Acceptance (master) - 225 - 2025-11-01[04:39:35]

      ci:test:stable - 9 out of 12 jobs PASSED
      9 Successful Jobs:
        ci:test:relevant - 12 out of 19 jobs PASSED

        7 Failed Jobs:

        12 Successful Jobs:
          For more details click here.

          Failures unique to this pull:

          1. js-unit/0/0
            Build was aborted
          2. js-unit/1/0
            Build was aborted
          3. playwright-js-tomcat101-mysql84/1/0 - Playwright Report
            1. frontend-data-set-admin-web/main/tests/data-set-admin/creationActions.spec.ts
            2. frontend-data-set-admin-web/main/tests/data-set-admin/clientExtensionFilters.spec.ts
            3. frontend-data-set-admin-web/main/tests/data-set-admin/dateRangeFilters.spec.ts
            4. ...
          4. playwright-js-tomcat101-mysql84/1/1 - Playwright Report
            1. frontend-data-set-admin-web/main/tests/data-set-fragment/clientExtensionFilters.spec.ts
            2. frontend-data-set-admin-web/main/tests/data-set-fragment/itemActions.spec.ts
            3. frontend-data-set-admin-web/main/tests/data-set-fragment/dateRangeFilters.spec.ts
            4. ...
          5. ...

          For upstream results, click here.

          Test bundle downloads:

          @liferay-continuous-integration
          Copy link
          Collaborator

          @markocikos
          Copy link
          Collaborator Author

          ci:test:relevant

          @liferay-continuous-integration
          Copy link
          Collaborator

          Test suite relevant has been triggered on http://test-1-27

          @liferay-continuous-integration
          Copy link
          Collaborator

          ❌ ci:test:stable - 9 out of 12 jobs passed

          ❌ ci:test:relevant - 12 out of 19 jobs passed in 2 hours 14 minutes

          Click here for more details.

          Base Branch:

          Branch Name: master
          Branch GIT ID: 688ac0c3f7303241d7706409fb6d26e7b67dde60

          Upstream Comparison:

          Branch GIT ID: e78e0629309887903e2b29cf9a78fb3e19b72915
          Jenkins Build URL: EE Development Acceptance (master) - 228 - 2025-11-03[00:37:34]

          ci:test:stable - 9 out of 12 jobs PASSED
          9 Successful Jobs:
            ci:test:relevant - 12 out of 19 jobs PASSED

            7 Failed Jobs:

            12 Successful Jobs:
              For more details click here.

              Failures unique to this pull:

              1. js-unit/1/0
                Build was aborted
              2. playwright-js-tomcat101-mysql84/1/0 - Playwright Report
                1. frontend-data-set-admin-web/main/tests/data-set-admin/creationActions.spec.ts
                2. frontend-data-set-admin-web/main/tests/data-set-admin/clientExtensionFilters.spec.ts
                3. frontend-data-set-admin-web/main/tests/data-set-admin/dateRangeFilters.spec.ts
                4. ...
              3. playwright-js-tomcat101-mysql84/1/1 - Playwright Report
                1. frontend-data-set-admin-web/main/tests/data-set-fragment/clientExtensionFilters.spec.ts
                2. frontend-data-set-admin-web/main/tests/data-set-fragment/itemActions.spec.ts
                3. frontend-data-set-admin-web/main/tests/data-set-fragment/dateRangeFilters.spec.ts
                4. ...
              4. ...

              For upstream results, click here.

              Test bundle downloads:

              @liferay-continuous-integration
              Copy link
              Collaborator

              @markocikos
              Copy link
              Collaborator Author

              Followup in #5213

              @markocikos markocikos closed this Dec 3, 2025
              Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

              Projects

              None yet

              Development

              Successfully merging this pull request may close these issues.

              2 participants