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

Form parse errors are not captured and reported back to front-end #682

Open
dacook opened this issue Feb 7, 2024 · 0 comments
Open

Form parse errors are not captured and reported back to front-end #682

dacook opened this issue Feb 7, 2024 · 0 comments

Comments

@dacook
Copy link

dacook commented Feb 7, 2024

Bug Report

Describe the bug

During development, I encountered an error (see stack trace below), but this did not result in the lifecycle event reflexError. Instead I was left watching a loading screen while nothing happened.

To Reproduce

Attempting to create a multi-record form with blank ID value, eg:

<input autocomplete="off" type="hidden" name="[products][0][variants_attributes][][name]" value="">

(I'm probably doing something wrong, but still the error should be caught).

Expected behavior

Lifecycle event reflexError being called.

Screenshots or reproduction

Example stack trace:

Reflex products#bulk_update failed: expected Array (got Rack::QueryParser::Params) for param `variants_attributes' [http://localhost:3000/admin/products]
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:113:in `normalize_params'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:122:in `normalize_params'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:122:in `normalize_params'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:75:in `block in parse_nested_query'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:72:in `each'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/query_parser.rb:72:in `parse_nested_query'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/rack-2.2.8/lib/rack/utils.rb:113:in `parse_nested_query'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stimulus_reflex-3.5.0.rc3/lib/stimulus_reflex/reflex_data.rb:51:in `form_data'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stimulus_reflex-3.5.0.rc3/lib/stimulus_reflex/reflex_data.rb:59:in `form_params'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stimulus_reflex-3.5.0.rc3/lib/stimulus_reflex/reflex_data.rb:55:in `params'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stimulus_reflex-3.5.0.rc3/lib/stimulus_reflex/reflex_factory.rb:14:in `create_reflex_from_data'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stimulus_reflex-3.5.0.rc3/app/channels/stimulus_reflex/channel.rb:19:in `receive'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/view_component_reflex-3.1.14.pre9/lib/view_component_reflex/engine.rb:30:in `receive'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/channel/base.rb:268:in `public_send'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/channel/base.rb:268:in `dispatch_action'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/channel/base.rb:170:in `block in perform_action'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/notifications.rb:206:in `block in instrument'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/notifications.rb:206:in `instrument'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/channel/base.rb:169:in `perform_action'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/connection/subscriptions.rb:56:in `perform_action'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/connection/subscriptions.rb:19:in `execute_command'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/connection/base.rb:89:in `dispatch_websocket_message'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/server/worker.rb:59:in `block in invoke'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:118:in `block in run_callbacks'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/tagged_logging.rb:99:in `block in tagged'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/tagged_logging.rb:37:in `tagged'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/tagged_logging.rb:99:in `tagged'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/connection/tagged_logger_proxy.rb:24:in `tag'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/server/worker/active_record_connection_management.rb:16:in `with_database_connections'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/engine.rb:71:in `block (4 levels) in <class:Engine>'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/execution_wrapper.rb:92:in `wrap'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/engine.rb:66:in `block (3 levels) in <class:Engine>'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:127:in `instance_exec'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:127:in `block in run_callbacks'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/activesupport-7.0.8/lib/active_support/callbacks.rb:138:in `run_callbacks'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/server/worker.rb:42:in `work'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/server/worker.rb:58:in `invoke'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/actioncable-7.0.8/lib/action_cable/server/worker.rb:53:in `block in async_invoke'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:359:in `run_task'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:350:in `block (3 levels) in create_worker'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `loop'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:341:in `block (2 levels) in create_worker'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `catch'
/Users/dcook/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/concurrent-ruby-1.2.3/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:340:in `block in create_worker'

Versions

StimulusReflex

  • Gem: 3.5.0.rc3
  • Node package: 3.5.0-rc3

External tools

  • Ruby: 3.1.4
  • Rails: 7.0.8
  • Node: 17.9.1

Browser

  • Browser: Chrome
  • Version: latest
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

No branches or pull requests

1 participant