Fetch optionLists in individual requests #14122
Labels
added-to-sprint
frontend
quality/code
Violations from current rules for code, best practices, etc. Or just bad code.
skip-documentation
Issues where updating documentation is not relevant
skip-releasenotes
Issues that do not make sense to list in our release notes
team/studio-domain1
Description
Today we are fetching all optionLists from backend in a singel request. If one of them is in an invalid format, the whole request will fail and you will not be able to view the content of any of the lists.
We should add a query
useOptionListQuery.ts
that will use the endpoint for fetching a specified optionList based on a givenoptionListId
.In the places where we use the query today we should adapt it like this:
In OptionListEditor.tsx:
This component is already receiving the optionListId so we can simply replace the query and pass the id to the new hook. Then a potential error from this query in this component, will be handled correct as it is implemented today.
In AppContentLibrary.tsx:
We should adapt the code list implementation to take all
optionListIds
as the incoming data and aonGetCodeList
callback to fetch the singel code list when we need it. This way we will only get valid option lists to render and show an error per individual codeList.In ExportForm.tsx:
We should keep the fetch all query in order to use it in this component and accept that the exported form will not have any lists if the api call fails due to a single faulty code list. This functionality is developed along with the needs of a single customer and hidden behind a feature flag.
The text was updated successfully, but these errors were encountered: