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

Access to client's localStorage and sessionStorage #1091

Closed

Conversation

williamneto
Copy link

Issues

Discussed in #1083 and #1075

Solution

The methods use_local_storage and use_session_storage have been implemented to provide access to these two client storage instances.

Checklist

  • Tests have been included for all bug fixes or added functionality.
  • The changelog.rst has been updated with any significant changes.

@olivershetler
Copy link

Hello! Just wondering. Why hasn't this push been merged since July? I'm building a frontend service using ReactPy and it's a non-starter to not have access to local storage.

@kumaraguru1735
Copy link

I am stuck, there is no session_storage or local_storage or cookie like system to work with, In the middle of my dream project
Without any option , how to work with backend api for jwt auth ???
Do something fast...

@ipcloudlive
Copy link

Even Reflex, Flet having options for LocalStorage, SessionStorage
This project has released 5 years back, I am still wondering , why its not even having small option and proper docs
This is the reason , no one is using this project....
Even people who start to work on the project will drop their project at the middle, when they realase its a useless module...

@Micoder-dev
Copy link

Please consider this pull request; it addresses a crucial core feature that we urgently need.

@RWallan
Copy link

RWallan commented Dec 27, 2023

The PR seems to be ok and implements an extremely important feature. Mainly for those who want to put the project into production using Reactpy.
I will be stepping away from the project until such time as a persistent data system exists.
Hope it will be soon.

@Archmonger
Copy link
Contributor

Archmonger commented Dec 27, 2023

@williamneto Hey William. We've been trying to limit features in reactive-python/reactpy to things that have direct equivalents to ReactJS core features.

We like the concept of these hooks, but we were wondering if you could fork it into a separate package?

@Micoder-dev
Copy link

when will I expect the LocalStorage option?

@ipcloudlive
Copy link

There is no way to use this option ?

@Archmonger
Copy link
Contributor

Archmonger commented Dec 31, 2023

After discussion, we decided we don't want to create ~20 hooks for every single web application API directly within ReactPy core. #1075

ReactJS philosophy is to focus on primitives within the core library. So following that philosophy, we've landed on a generic use_script hook that would work as a better catch-all. #894

The use_script hook will rely on the infrastructure set up within our use_messenger PR, so we'll need to get that merged first. #1084

Hopefully we'll be able to get that pushed through within the next 30-60 days.

@Archmonger Archmonger closed this Dec 31, 2023
@williamneto
Copy link
Author

As sugested by @Archmonger , the implementation i proposed for local storage is in my fork williamneto/reactpy. Just merged the latest version of the original into the fork.

There is a usage sample in react/samples

@kumaraguru1735
Copy link

@williamneto How to build the project?

@Archmonger
Copy link
Contributor

Archmonger commented Jan 3, 2024

@williamneto I wasn't referring to forking the whole project. It would be better make a minimal package on PyPI named something like reactpy-client-storage.

That would require PRing ReactPy core to add some third-party extensibility to

  • client/src/components.tsx
  • client/src/reactpy-client.ts
  • reactpy/backend

Also, instead of creating unique properties within the Connection object, you can store local_storage and session_storage within the Connection.scope dict.

@ipcloudlive
Copy link

@Archmonger Better you can create on reactive-python account itself, so new bees will find out easily, and plz solve the issue as soon as possible bcz most people waiting for this option

@williamneto
Copy link
Author

So @Archmonger , i started studing arround this reactpy-client-storage approach. Realy makes more sense.

But i ended up in the same question presented in #1084 : the necessity to extend the client-server comunications, as by now it only supports LayoutEvent and LayoutUpdate messages.

After #1084 being merged it will be possible to think about extensions like reactpy-client-storage, reactpy-client-services, etc

@kumaraguru1735
Copy link

But #1084 is Still in the draft section since July 2023

@Archmonger
Copy link
Contributor

@kumaraguru1735 The PR author, Ryan, needed to step away from OSS for a few months. He's back since mid-December and progress will be made on that PR soon.

@Archmonger
Copy link
Contributor

Archmonger commented Jan 5, 2024

For people that need immediate access to these hooks, you can install William's fork via pip install 'git+https://github.com/williamneto/reactpy.git@main#subdirectory=src/py/reactpy'
Correction: It seems that you can't just git+ install the repo due to our new hatch build environment. I'll look into it.

We'll work with him to create a separate package for these hooks once the use_messenger primitive hits ReactPy core.

@kumaraguru1735
Copy link

When Will I expect it ?

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

Successfully merging this pull request may close these issues.

7 participants