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

[Bug] Cannot update cell value when using dtale with flask and redislite or external redis #594

Closed
bangnh1 opened this issue Nov 2, 2021 · 2 comments

Comments

@bangnh1
Copy link

bangnh1 commented Nov 2, 2021

Current Behavior:

  1. Access web browser and edit a cell
  2. Refresh the site
  3. The edited cell have been reverted to old value

Expected Behavior:

  • The edited cell keep the value when refresh the site

Steps To Reproduce:

I am using demo code as below.

from flask import redirect

import dtale
import pandas as pd
from dtale.app import build_app
from dtale.views import startup

if __name__ == '__main__':
    app = build_app(reaper_on=False)
    dtale.global_state.use_redis_store('./data')

    @app.route("/create-df")
    def create_df():
        df = pd.DataFrame(dict(a=[1, 2, 3], b=[4, 5, 6]))
        instance = startup(data=df, ignore_duplicate=True)
        return redirect(f"/dtale/main/{instance._data_id}", code=302)

    @app.route("/")
    def hello_world():
        return 'Hi there, load data using <a href="/create-df">create-df</a>'

    app.run(host="0.0.0.0", port=8080)

Environment:

dtale==1.59.1
Flask==2.0.2
redislite==6.0.674960

We are solving problem by setting data to global state in edit_cell function (views.py). Not a good solution but it worked.

global_state.set_data(data_id, data)
@aschonfeld
Copy link
Collaborator

aschonfeld commented Nov 4, 2021

@bangnh1 this is actually the correct solution. I think in the global_state upgrades last spring something must have been missed and since the majority of users use the default "in-memory" storage its stays hidden. I can release a hotfix with this fix added. Will update you when it has been released.

Apologies for the inconvenience

@aschonfeld
Copy link
Collaborator

@bangnh1 just released v1.60.2 to pypi. Will be on conda-forge shortly. This should solve the issue. Let me know if you any more issues and if you haven't already please toss your ⭐ on the repo. Thanks 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants