From 405f831f0496ba8bee79ecdb059f27ff02618658 Mon Sep 17 00:00:00 2001 From: Javier Luraschi Date: Mon, 4 Mar 2024 15:09:42 -0800 Subject: [PATCH] fix table with no columns --- examples/requirements.txt | 2 +- setup.py | 2 +- streamfy/__init__.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/requirements.txt b/examples/requirements.txt index f14cc9a..d3f785c 100644 --- a/examples/requirements.txt +++ b/examples/requirements.txt @@ -1,3 +1,3 @@ -streamfy==0.2.8 +streamfy==0.3.1 streamlit==1.15.2 diff --git a/setup.py b/setup.py index b65f340..22110a3 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,7 @@ setuptools.setup( name="streamfy", - version="0.3.0", + version="0.3.1", author="Javier Luraschi", author_email="jluraschi@gmail.com", description="Modern frontend web components based on Buefy for Streamlit.", diff --git a/streamfy/__init__.py b/streamfy/__init__.py index d9d605b..5b0d26e 100644 --- a/streamfy/__init__.py +++ b/streamfy/__init__.py @@ -154,8 +154,8 @@ def steps(**kwargs): def table(**kwargs): hyphened = hyphen_case_keys(kwargs) defaults_apply("table", hyphened) - if not "columns" in hyphened: - hyphened["columns"] = [{"field": key} for key in data[0].keys()] + if not "columns" in hyphened and "data" in kwargs and len(kwargs["data"]) > 0: + hyphened["columns"] = [{"field": key} for key in kwargs["data"][0].keys()] component_value = _component_func(component="table", **hyphened) return component_value