Skip to content

Commit

Permalink
pkp/pkp-lib#10917 Fix days filter. Ensure that non-array fields are h…
Browse files Browse the repository at this point in the history
…andle correctly.
  • Loading branch information
jardakotesovec committed Feb 11, 2025
1 parent 405330d commit 4877c16
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/composables/useFiltersForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ function createSelected(values, labels) {

export function useFiltersForm(_filtersForm) {
const filtersForm = ref(_filtersForm);
const {clearForm, removeFieldValue, setValue} = useForm(_filtersForm);
const {clearForm, removeFieldValue, setValue, isFieldValueArray} =
useForm(_filtersForm);

const filtersFormList = computed(() => {
const list = [];
Expand Down Expand Up @@ -109,7 +110,10 @@ export function useFiltersForm(_filtersForm) {
function initFiltersFormFromQueryParams(queryParams) {
filtersForm.value.fields.forEach((field) => {
if (queryParams[field.name]) {
const values = ensureArray(queryParams[field.name]).map(fixValueType);
const values = isFieldValueArray(field)
? ensureArray(queryParams[field.name]).map(fixValueType)
: fixValueType(queryParams[field.name]);

if (queryParams[`${field.name}_label`]) {
const labels = ensureArray(queryParams[`${field.name}_label`]);
setValue(field.name, createSelected(values, labels));
Expand Down

0 comments on commit 4877c16

Please sign in to comment.