Skip to content

Commit

Permalink
bugfix for upload event (#1042)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElijahAhianyo authored May 17, 2023
1 parent aa68446 commit 0c33ad1
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions pynecone/utils/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,7 @@ def format_event(event_spec: EventSpec) -> str:
event_args = [
wrap(format_event_handler(event_spec.handler), '"'),
]
if len(args) > 0:
event_args.append(wrap(args, "{"))
event_args.append(wrap(args, "{"))

if event_spec.client_handler_name:
event_args.append(wrap(event_spec.client_handler_name, '"'))
Expand Down
2 changes: 1 addition & 1 deletion tests/components/test_tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def mock_event(arg):
({"a": 1, "b": 2, "c": 3}, '{{"a": 1, "b": 2, "c": 3}}'),
(
EventChain(events=[EventSpec(handler=EventHandler(fn=mock_event))]),
'{_e => Event([E("mock_event")], _e)}',
'{_e => Event([E("mock_event", {})], _e)}',
),
(
EventChain(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_fn_with_args(_, arg1, arg2):

assert event_spec.handler == handler
assert event_spec.args == ()
assert format.format_event(event_spec) == 'E("test_fn")'
assert format.format_event(event_spec) == 'E("test_fn", {})'

handler = EventHandler(fn=test_fn_with_args)
event_spec = handler(make_var("first"), make_var("second"))
Expand Down

0 comments on commit 0c33ad1

Please sign in to comment.