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

🐛 disable controls using loadingOverlay #53

Merged
merged 4 commits into from
Jul 25, 2023

Conversation

hannahker
Copy link
Collaborator

@hannahker hannahker commented Jul 21, 2023

Proposing a slightly simpler approach to #51 -- addressing #41. I like this approach because it means that we don't have to update any callbacks when new controls are added into the existing sections on the sidebar. Since the loading spinner itself isn't visible it looks basically the same as if the controls are disabled.

@github-actions
Copy link

github-actions bot commented Jul 21, 2023

Staging application has been deployed and is available at: https://dash5-services.plotly.host/ml-exchange-staging
Production app name: ml-exchange
Current branch name: disable-controls-with-overlay
Commit: 18a2abf

@danton267
Copy link
Collaborator

When the app initially loads or when the project is changed, app has to ask the server for the project data to be able to populate sliders with the correct number of slices.
It does it here:

if not disable_slider:
tiff_file = data[project_name]

On my PC it can take from 0.01s - 5s (especially when you load in another browser/incognito so it doesn't cache anything). While this callback is waiting to finish, the controls are able to be clicked on since the overlays are controlled by render_image()

You can change render_image() into

    Output("data-selection-controls", "children", allow_duplicate=True),
    Output("image-transformation-controls", "children", allow_duplicate=True),
    Output("annotations-controls", "children", allow_duplicate=True),

and add them to update_slider_values() too


    Output("data-selection-controls", "children"),
    Output("image-transformation-controls", "children"),
    Output("annotations-controls", "children"),

However, every time update_slider_values() finishes, the controls will "flash" and become clickable for a brief period of time, before render_image() disables them again.

@hannahker
Copy link
Collaborator Author

Good catch @danton267! Thought about this for a bit and I'm not too concerned about the timing of the update_slider_values(), since I don't see any lag for this on the deployed app. I'd also expect this to be quite fast especially after we get the app deployed on LBL's infrastructure. My proposal would be to merge this in it's current state and revisit if needed in the future.

What do you think?

@danton267
Copy link
Collaborator

I would personally add

    Output("data-selection-controls", "children"),
    Output("image-transformation-controls", "children"),
    Output("annotations-controls", "children"),

to update_slider_values() since that is part of the issue.
When the page loads it does not necessarily depend on the server only, users with slower PC could experience the initial offset while update_slider_values() is executing.

The split-second "flash" after update_slider_values() finishes and before render_image() overlay starts can be ignored for now, and if requested, we can always use #51 for better UX.

Either way, looks good to me

Copy link
Collaborator

@danton267 danton267 left a comment

Choose a reason for hiding this comment

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

All good! Can be merged

@hannahker hannahker merged commit 2d817fd into main Jul 25, 2023
@hannahker hannahker deleted the disable-controls-with-overlay branch July 25, 2023 15:55
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.

2 participants