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

stateful widget calls dispose on FocusNode but state still there #99

Closed
dupuchba opened this issue May 31, 2022 · 3 comments
Closed

stateful widget calls dispose on FocusNode but state still there #99

dupuchba opened this issue May 31, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@dupuchba
Copy link
Contributor

Edge case
note that it's not a bug but we'd like to improve user XP when this happens

Repro :
1/ having some kind of StreamBuilder with firebase for example

(m/StreamBuilder
      :stream stream
      :builder
      (fn [_ snapshot]
        (let [connection-state (.-connectionState snapshot)]
          (if (or
                (== connection-state m.ConnectionState/none)
                (== connection-state m.ConnectionState/waiting))
            login
            (if (== connection-state m.ConnectionState/done)
              
              (m/Text "Don't know what to do here")
              (if-some [user (.-data snapshot)]
                main-app
                login))))))

2/ then your login is a stateful widget with focus-node and a TextField for example

(f/widget
     
     :with [focus-node-email (m/FocusNode)
            focus-node-password (m/FocusNode)])

3/ dispose will be call but focus-node will still be used after-all creating a sucky exception

Temporary solution :
wrap the stateful widget in a stateless one (f/widget my-stateful-widget)

@dupuchba dupuchba added the enhancement New feature or request label May 31, 2022
@cgrand
Copy link
Contributor

cgrand commented May 31, 2022

Can you make a self contained runnable minimal repro?

@cgrand
Copy link
Contributor

cgrand commented Jun 28, 2022

(def my-widget (f/widget ...)) of stateful widgets seems to be problematic.

@dupuchba
Copy link
Contributor Author

At that time I was mislead, it's not a state problem but it's how we update streams

@dupuchba dupuchba closed this as completed Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants