Skip to content

Commit 9b140ca

Browse files
committed
Code feedback
1 parent 1cb1fce commit 9b140ca

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

shiny/api-examples/remove_accordion_panel/app-core.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def make_panel(letter: str) -> ui.AccordionPanel:
2727

2828
def server(input: Inputs, output: Outputs, session: Session):
2929
# Copy the list for user
30-
user_choices = list(choices)
30+
user_choices = choices.copy()
3131

3232
@reactive.effect
3333
@reactive.event(input.remove_panel)

shiny/api-examples/remove_accordion_panel/app-express.py

+4-7
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,16 @@
2020
f"Some narrative for section {letter}"
2121

2222

23-
user_choices = list(choices)
24-
25-
2623
@reactive.effect
2724
@reactive.event(input.remove_panel)
2825
def _():
29-
if len(user_choices) == 0:
26+
if len(choices) == 0:
3027
ui.notification_show("No more panels to remove!")
3128
return
3229

33-
ui.remove_accordion_panel("acc", f"Section {user_choices.pop()}")
30+
ui.remove_accordion_panel("acc", f"Section {choices.pop()}")
3431

3532
label = "No more panels to remove!"
36-
if len(user_choices) > 0:
37-
label = f"Remove Section {user_choices[-1]}"
33+
if len(choices) > 0:
34+
label = f"Remove Section {choices[-1]}"
3835
ui.update_action_button("remove_panel", label=label)

0 commit comments

Comments
 (0)