datasette-vega icon indicating copy to clipboard operation
datasette-vega copied to clipboard

Maybe check for `columns` rather than looking at `view_name`

Open simonw opened this issue 3 years ago • 2 comments
trafficstars

diff --git a/datasette_vega/__init__.py b/datasette_vega/__init__.py
index ac80b52..ba69145 100644
--- a/datasette_vega/__init__.py
+++ b/datasette_vega/__init__.py
@@ -17,12 +17,12 @@ def cached_filepaths_for_extension(extension):
 
 
 @hookimpl
-def extra_css_urls(view_name):
-    if view_name == "table":
+def extra_css_urls(columns):
+    if columns:
         return cached_filepaths_for_extension("css")
 
 
 @hookimpl
-def extra_js_urls(view_name):
-    if view_name == "table":
+def extra_js_urls(columns):
+    if columns:
         return cached_filepaths_for_extension("js")

simonw avatar Dec 10 '21 22:12 simonw

Found this diff on my laptop and I can't remember why or when I did it!

simonw avatar Dec 10 '21 22:12 simonw

The view_name == "table" change caused the chart to disappear from the query page. I'd highly suggest applying this change to master.

I've merged this change into my working branch: https://github.com/brandonrobertz/datasette-vega

brandonrobertz avatar Oct 08 '22 21:10 brandonrobertz