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

🔙 from #742 - 🐛 Repeated values found on multi search layers with the same value of a select input #748

Merged
merged 1 commit into from
Feb 26, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/utils/getDataForSearchInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ export async function getDataForSearchInput({ state, field, suggest }) {
})))
)
.filter(d => 'fulfilled' === d.status)
.reduce((acc, d) => acc.concat(d.value.data || []), []) // uniques by fformatter
.reduce((acc, d, i) => 0 === i
? acc.concat(d.value.data || []) // for first layer get all uninques values
: [...new Set([...(d.value.data || []), ...acc].map(JSON.stringify))].map(JSON.parse), // ensure uniques values (search performed on multiple serach_layers)
[]
)
.map(([value, key]) => ({ key, value }));

} catch(e) { console.warn(e); }
Expand Down