# Streamlit-aggrid -\> browser refreshing issue

**URL:** <https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851>\
**Category:** Using Streamlit\
**Tags:** aggrid, debugging\
**Created:** [March 30, 2024, 8:38am UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851 "2024-03-30T08:38:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ameen](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ameen/32/28356_2.png) [@Ameen](https://discuss.streamlit.io/u/Ameen)\
**Post date:** [March 30, 2024, 8:38am UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851/1 "2024-03-30T08:38:52Z")

</div>

Im running my app locally and have installed streamlit-aggrid, I attempted to use a sample code, but I’m encountering an odd behavior. when i refreshes the browser the table display is getting lost sometimes

```auto
import pandas as pd
import streamlit as st
from st_aggrid import AgGrid

df = pd.read_csv(
    "https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv"
)

AgGrid(df)

```

each time I refresh the browser, my terminal prints True even though I haven’t included any print statement in my code.

---

<div class="post-metadata">

**Author:** ![ferdy](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ferdy/32/29957_2.png) [@ferdy](https://discuss.streamlit.io/u/ferdy)\
**Post date:** [March 30, 2024, 2:04pm UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851/2 "2024-03-30T14:04:00Z")

</div>

You need to put the dataframe in a cache or memory for performance.

```auto
@st.cache_data(ttl='1d') # clear the cache after 1 day
def data():
    df = pd.read_csv(
        "https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv"
    )
    return df

```

Then use that in aggrid.

```auto
df = data()

AgGrid(
    df,
    enable_enterprise_modules=False,
    height=300
)

```

Happy to see this great library has been updated.

 ![image](https://global.discourse-cdn.com/streamlit/original/3X/4/f/4fff933c473d51a1bcbcec73f96bc69363701bc2.png)

> [@Ameen](#):
>
> each time I refresh the browser, my terminal prints True

This was part of the debugging that was left and should not cause an issue.

---

<div class="post-metadata">

**Author:** ![Ameen](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ameen/32/28356_2.png) [@Ameen](https://discuss.streamlit.io/u/Ameen)\
**Post date:** [April 1, 2024, 1:11pm UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851/3 "2024-04-01T13:11:11Z")

</div>

Hi @ferdy thank you for the response now its working fine and also I have upgraded streamlit for resolving the issue, now i have another concern:

 ![image](https://global.discourse-cdn.com/streamlit/original/3X/2/9/29c9d6764269c61f7bfc69a8b2b7a63ef1f2fbfa.png)  
so, I have this filter dropdown in order to close it either I need to click on the filter icon or anywhere inside that grid but when I clicked outside of the grid, it will not close is there any solution for it.

---

<div class="post-metadata">

**Author:** ![ferdy](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ferdy/32/29957_2.png) [@ferdy](https://discuss.streamlit.io/u/ferdy)\
**Post date:** [April 1, 2024, 6:55pm UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851/4 "2024-04-01T18:55:45Z")

</div>

It could be just a design decision not to exit when user is wandering outside of the grid. It is also a reasonable decision because the user can come back to it later to finish what needs to be done in the grid. Also if there is a mouse-slip outside of the grid, no worries the user can comeback to it too.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [April 3, 2024, 6:56pm UTC](https://discuss.streamlit.io/t/streamlit-aggrid-browser-refreshing-issue/65851/5 "2024-04-03T18:56:22Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
