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

Column cog shows "facet by this" when already default faceted #1469

Closed
simonw opened this issue Sep 13, 2021 · 2 comments
Closed

Column cog shows "facet by this" when already default faceted #1469

simonw opened this issue Sep 13, 2021 · 2 comments

Comments

@simonw
Copy link
Owner

simonw commented Sep 13, 2021

e.g. on https://covid-19.datasettes.com/covid/economist_excess_deaths

covid__economist_excess_deaths__17_576_rows_where_sorted_by_end_date_descending_and_New_Issue_·_simonw_datasette

But if you add ?_facet=country to the URL that goes away: https://covid-19.datasettes.com/covid/economist_excess_deaths?_facet_size=5&_facet=country

The logic that decides if the "Facet by this" item is shown does not take default metadata.json facets into account.

@simonw
Copy link
Owner Author

simonw commented Sep 13, 2021

Here's the code at fault:

if (
isFirstColumn ||
params.getAll("_facet").includes(column) ||
isSinglePk
) {
facetItem.parentNode.style.display = "none";
} else {
facetItem.parentNode.style.display = "block";
facetItem.setAttribute("href", facetUrl(column));
}

@simonw
Copy link
Owner Author

simonw commented Oct 13, 2021

The core problem here is treating the ?_facet= query string parameters as the point of truth for which facets are currently enabled.

Instead, I could use a data- attribute on the displayed facets.

@simonw simonw closed this as completed in 763d0a0 Oct 13, 2021
simonw added a commit that referenced this issue Oct 14, 2021
simonw added a commit that referenced this issue Oct 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant