Skip to content
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

Tide Custom Collection filters using aggregations don't update their field options after aggregations load. #1104

Closed
2 tasks done
alan-cole opened this issue Apr 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@alan-cole
Copy link
Contributor

alan-cole commented Apr 5, 2024

Environment

  • Operating System: Darwin
  • Node Version: v16.16.0
  • Nuxt Version: 3.6.5
  • Nitro Version: 2.5.2
  • Package Manager: npm@8.12.1
  • Builder: vite
  • User Config: extends
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Create a Custom Collection using a filter that is loaded through aggregations, e.g.

{
  "id": "demo",
  "component": "TideSearchFilterDropdown",
  "filter": {
    "type": "term",
    "value": "field_location_category_name",
    "multiple": false
  },
  "aggregations": {
    "field": "field_location_category_name",
    "source": "elastic"
  },
  "props": {
    "id": "demo",
    "label": "Demo field",
    "placeholder": "Select",
    "type": "RplFormDropdown",
    "multiple": false
  }
}

As we have no props.options defined, it should update it's dynamicOptions after the aggregations have completed.

Describe the bug

TideCustomCollection.vue has:

  1. a prop userFilters which is passed to TideSearchFilters attribute filterInputs to defined form elements for user changeable filters.
  2. a reactive variable uiFilters which is initially set to userFilters.
  3. a hook onAggregationUpdateHook that runs when aggregations are retrieved.

When onAggregationUpdateHook runs, it updates the options in the uiFilters ref, but these new options are not reflected to the user because TideSearchFilters's attribute filterInputs is not populated from uiFilters, but from userFilters.

By changing this line:

https://github.com/dpc-sdp/ripple-framework/blob/develop/packages/ripple-tide-search/components/global/TideCustomCollection.vue#L498

from :filterInputs="userFilters" to :filterInputs="uiFilters", when aggregations become available, the form options will correctly update.

Additional context

This bug may also be present in TideSearchListingPage, as it seems to have the same pattern:

https://github.com/dpc-sdp/ripple-framework/blob/develop/packages/ripple-tide-search/components/TideSearchListingPage.vue#L150C7-L150C16
uiFilters that update

https://github.com/dpc-sdp/ripple-framework/blob/develop/packages/ripple-tide-search/components/TideSearchListingPage.vue#L385
userFilters that is passed to the form.

Solution example

Below are 2 videos to show the difference between the bug as it currently is, and the proposed solution.

https://github.com/dpc-sdp/ripple-framework/assets/12739575/49857c0f-79ce-41a8-b6fe-114d33c12300
In this video using the OOTB TideCustomCollection, the "Area of law" dropdown is still not populated with aggregated results even after the pins have loaded.

https://github.com/dpc-sdp/ripple-framework/assets/12739575/ae38e116-79aa-4920-9521-b4440406aca9
In this video using a modified TideCustomCollection with the uiFilters change, the aggregate results appear as soon as the pins have loaded.

Logs

No response

Final checks

@alan-cole alan-cole added the bug Something isn't working label Apr 5, 2024
@alan-cole alan-cole changed the title Tide Custom Collection filters using aggregations don't update with their fields after page load. Tide Custom Collection filters using aggregations don't update their field options after aggregations load. Apr 5, 2024
@lambry
Copy link
Contributor

lambry commented Nov 8, 2024

Closing issue as this has been address here: #1183

@lambry lambry closed this as completed Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants