Skip to content

Conversation

@wch
Copy link
Collaborator

@wch wch commented Jan 12, 2024

This PR renames suspend_display to hide. The old name feels very advanced, and it also sounds imperative and stateful, and it refers to a state that most users don't really need to understand and could be confusing. For example, a user might thing, "OK, so we were displaying before, but now we're suspending it... and then how do I resume it?"

Here are some examples of usage:

@suspend_display
@render.text()
def txt():
    return "Text here"


with suspend_display():
    @render.text()
    def txt2():
        return "Text here"


ui.output_text("txt", inline=True)
ui.output_text("txt2")

With hide(), it's a bit less confusing:

@hide
@render.text()
def txt():
    return "Text here"


with hide():
    @render.text()
    def txt2():
        return "Text here"


ui.output_text("txt", inline=True)
ui.output_text("txt2")

One possibly confusing thing about using hide or hidden is that it might suggest to the user that the rendered content won't be shown at all, when in fact it will be shown where the corresponding output_*() function is used.

@wch wch added this to the v0.7.0 milestone Jan 12, 2024
@wch wch marked this pull request as draft January 12, 2024 04:06
@wch wch mentioned this pull request Jan 12, 2024
55 tasks
@gadenbuie
Copy link
Collaborator

One possibly confusing thing about using hide or hidden is that it might suggest to the user that the rendered content won't be shown at all, when in fact it will be shown where the corresponding output_*() function is used.

To avoid this connotation, I was thinking of proposing @hold for the decorator. It conveys the sense that Shiny Express is holding back the UI, but it's still available to be used.

@gadenbuie
Copy link
Collaborator

Maybe we could hang this decorator and @display_body together with something like @display_hide, @display_hold or @display_suspend. While I have argued against @suspend_display, I think my concerns with that name are alleviated considerably by grouping similar decorators together in a corner of the API that facilitates discovery.

@jcheng5
Copy link
Collaborator

jcheng5 commented Jan 19, 2024

Just want to state for the record that I'd like this to work (especially if we use the name "hold"):

with hide() as held:
    @render.text()
    def txt2():
        return "Text here"

held

@wch
Copy link
Collaborator Author

wch commented Jan 19, 2024

Closing in favor of #1037.

@wch wch closed this Jan 19, 2024
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.

4 participants