Skip to content

Commit

Permalink
Merge branch 'fix/adjustments-in-value-filtering-in-urls' into alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
mguellsegarra committed Jan 24, 2025
2 parents 704fc75 + 1b5d7dd commit 64fa60b
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions src/hooks/useUrlFromCurrentTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,32 @@ export function useUrlFromCurrentTab({
};

const { action_id } = currentTab.action;

let finalValues = currentTab.action.values || {};
const formValues = formRef.current?.getPlainValues() || {};

// For tree view with active_ids, action values have priority over form values
if (initialView.type === "tree" && finalValues.active_ids) {
finalValues = {
...formValues,
...finalValues,
};
} else {
// For all other cases, form values (if any) have priority over action values
finalValues = {
...finalValues,
...formValues,
};
}

const finalActionData: ActionInfo = {
...currentTab.action,
...(initialView && { initialView }),
...(searchParams && { searchParams }),
...(currentId && { res_id: currentId }),
actionRawData: {
...currentTab.action.actionRawData,
values: {
...currentTab.action.values,
...(formRef.current?.getPlainValues() || {}),
},
values: finalValues,
},
};

Expand Down

0 comments on commit 64fa60b

Please sign in to comment.