Skip to content

Commit

Permalink
doc: add halted to demo
Browse files Browse the repository at this point in the history
If a event chain is halted, it fires the 'V:eventsHalted' event.
That can be handled so that the default error handling does not kick in and you can handle it yourself.

The post was issuing a multi-part post with body. That is a malformed request and starting with Rack 2.2.2 will generate an exception. rack/rack#1603
This fixes that issue.
  • Loading branch information
rx committed Jun 16, 2021
1 parent 951a1d9 commit ce91765
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions app/demo/events/halted.pom
@@ -0,0 +1,23 @@
Voom::Presenters.define(:halted) do
helpers Demo::Helpers::IndentedGrid
attach :top_nav
attach :events_drawer

indented_grid do
display 'Halted Events'
body 'This demonstrates how to respond to failed, or halted events'

content do
button :failed_post do
event :click do
posts '_echo_', status: 500
end
event 'V:eventsHalted' do
snackbar 'That did not work! Please try again later.'
end
end

end
end
attach :code, file: __FILE__
end
2 changes: 1 addition & 1 deletion app/demo/events/nav/drawer.pom
@@ -1,7 +1,7 @@
Voom::Presenters.define(:events_drawer) do
helpers Voom::Presenters::Helpers::Inflector

events = %i[field_level_events form_level_events tagged_input parallel_events].sort
events = %i[field_level_events form_level_events tagged_input parallel_events halted].sort
actions = %i[dialog replaces loads toggle_visibility snackbar updates deletes posts clear last_response prompt_if_dirty].sort

drawer 'Events' do
Expand Down

0 comments on commit ce91765

Please sign in to comment.