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

Autofocus "clear cache" button #2739

Merged
4 commits merged into from Feb 8, 2021
Merged

Autofocus "clear cache" button #2739

4 commits merged into from Feb 8, 2021

Conversation

ghost
Copy link

@ghost ghost commented Feb 5, 2021

FIxes #2698

@ghost ghost self-requested a review February 5, 2021 02:12
Copy link
Collaborator

@vdonato vdonato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be relatively easy to add a test that the button is autofocused as expected? If it's not too hard would be good to do that, otherwise LGTM

@ghost
Copy link
Author

ghost commented Feb 5, 2021

@vdonato Done!

</Fragment>
)

// Wait until the next frame of the event loop, to give React a chance to
Copy link
Collaborator

@vdonato vdonato Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, is there a chance that this might end up flaky since we don't have total control over what happens in the event loop?

I feel like in practice tests are controlled enough that we can be sure that the next thing on the event loop is going to be to focus the button, but just double-checking.

Copy link
Author

@ghost ghost Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be honest, not sure. I saw this comment by the React team that autoFocus calls .focus() on mount. This whole time I've just been mindlessly using this trick to wait for componentDidMount to run.

Looking online, though, apparently flushing Promises with setImmediate is the way to go, so I changed it.

@ghost ghost merged commit df51f92 into streamlit:develop Feb 8, 2021
@ghost ghost deleted the autofocus-clear-cache branch February 8, 2021 20:13
tconkling added a commit that referenced this pull request Feb 8, 2021
* develop:
  Autofocus "clear cache" button (#2739)
  Fix checkbox spacing (#2738)
  Fix progress bar alignment (#2734)
  Fix select menu not autoselecting first item (#2732)
  Show user command line in disconnect dialog (#2735)
  Up version to 0.76.0
  Update change log
  Improve usage warning wording and formatting
  Finally remove beta versions of set_page_config and color_picker (#2711)
  Finally remove beta versions of set_page_config and color_picker (#2711)
  Clean up file update calls (#2597)
tconkling added a commit to tconkling/streamlit that referenced this pull request Feb 11, 2021
* develop:
  Slider thumb values are always visible (streamlit#2724)
  Update component-template submodule to latest (streamlit#2767)
  `allow_multiple_files` -> `accept_multiple_files` (streamlit#2761)
  Autofocus "clear cache" button (streamlit#2739)
  Fix checkbox spacing (streamlit#2738)
  Fix progress bar alignment (streamlit#2734)
  Fix select menu not autoselecting first item (streamlit#2732)
  Show user command line in disconnect dialog (streamlit#2735)
  Up version to 0.76.0
  Update change log
  Improve usage warning wording and formatting
  Finally remove beta versions of set_page_config and color_picker (streamlit#2711)
  Finally remove beta versions of set_page_config and color_picker (streamlit#2711)
  Clean up file update calls (streamlit#2597)
CFrez pushed a commit to CFrez/streamlit that referenced this pull request Feb 18, 2021
* autofocus clear cache button

* add test

* update test

* fix lint
schaumb pushed a commit to FloWide/streamlit that referenced this pull request Feb 22, 2021
* autofocus clear cache button

* add test

* update test

* fix lint
kmcgrady pushed a commit that referenced this pull request Feb 24, 2021
* created conditional rendering of controls & tests

* reorganized and added tests

* removed accidently added unneeded import

* alter flex, padding and gap to align columns

* adjusted spacing since not duplicated

* alter flex, padding and gap to align columns

* adjusted spacing since not duplicated

* Fix checkbox spacing (#2738)

* remove extra padding

* remove snapshot completely

* add snapshot back in

* remove snapshots

* remove rest of snapshots

* add snapshots back in

* Autofocus "clear cache" button (#2739)

* autofocus clear cache button

* add test

* update test

* fix lint

* `allow_multiple_files` -> `accept_multiple_files` (#2761)

* Update component-template submodule to latest (#2767)

Point our `component-template` submodule to the latest commit in that repo.

(Among other things, this will de-dupe a bunch of the `component-lib` code that used to live in `component-template` before being pulled into its own npm package.)

* Slider thumb values are always visible (#2724)

* Close #2699

* Override Thumb subcomponent completely

* Fixed linting errors

Co-authored-by: Ken McGrady <[email protected]>

* Create base color picker for use with API and internally (#2778)

* Copy to shared and cleanup

* Cleanup

* remove comment

* config: client.showTracebacks (#2770)

Adds a new config option, `"client.showTracebacks"`. By default, it's `True`.

If the option is set to `False`, then uncaught exceptions in a Streamlit app will result in a generic "Something went wrong!" warning in the browser, rather than the exception and its traceback

This logic happens in the `error_util.handle_uncaught_app_exception` function, rather than directly within ScriptRunner.

`scriptrunner_test`, `caching_test`, and `streamlit_test` have new tests that verify the right thing happens when exceptions are thrown in different circumstances with this config option turned on and off.

Closes #1032

* Shared selectbox (#2795)

* Remove nonexistent elements from widget state (#2760)

* remove nonexistent elements from widget states

* fix typo

* add test

* Fix datetime timezone handling in data frames (#2784)

* save changes

* remove redundant change

* fix tests

* fix quotes

* add tests and other fixes

* fix lint

* update protobufs and tests

* add e2e test

* fix quotes

* update test

* Revert "removed accidently added unneeded import"

This reverts commit f886adc.

* Revert "reorganized and added tests"

This reverts commit d3632d9.

* Revert "created conditional rendering of controls & tests"

This reverts commit 7c4400e.

* updated tests

* fixed lint

* correct percentages in spec for test

* update st_image column image

* added comment to HoizontalBlock

* added Issue/PR to comment

Co-authored-by: bh-streamlit <[email protected]>
Co-authored-by: Simon Biggs <[email protected]>
Co-authored-by: Tim Conkling <[email protected]>
Co-authored-by: Henrikh Kantuni <[email protected]>
Co-authored-by: Ken McGrady <[email protected]>
Co-authored-by: karrie <[email protected]>
This pull request was closed.
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.

Clear cache dialog should default to "clear" [regression]
1 participant