-
-
Notifications
You must be signed in to change notification settings - Fork 508
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
Fix problem with item name dropdown selection #4883
Fix problem with item name dropdown selection #4883
Conversation
@cielf Can you share the steps to reproduce that issue? |
Huh -- I am having trouble reproducing it myself. |
Got it. |
@cielf That issue isn't introduced by these changes—it already exists on Also, it wouldn't occur with the refactoring I previously added on the now closed PR, but I removed all refactoring so this PR would be smaller and still provide the bug fix for the #4547 issue. |
It is definitely an edge case . I'll throw it in the in-box for writeup. (Terminology note: I don't consider it refactoring if it introduces functional changes, but that's a discussion for a different forum ) |
Ok. Other than that, this seems to do the job. over to @dorner for tech eval. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question around how this would interact with #4882 - should we just reuse the Option class from there?
app/models/view/inventory.rb
Outdated
@@ -5,9 +5,15 @@ module Types | |||
module View | |||
# A wrapper around event-driven InventoryAggregate for use in views. | |||
class Inventory | |||
ItemDropdownOption = Struct.new(:id, :name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this clash with the OpenStruct PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR was created before creating the generic Option
class was introduced. Fixed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
@coalest: Your PR |
Resolves #4547
Description
This issue occurs when an ajax call to populate the item names in the dropdown options occurs while the dropdown has been opened. Selecting an option doesn't work because that option no longer exists, so nothing happens (so item selected in the field will be the first item from the list of new options).
To fix this I made two changes:
/inventory.json
) every time you click "Add Another Item". And an ajax call is made to fetch the inventory whenever the storage location changes. I'm assuming it's not needed to fetch the inventory so often. So I changed it to only fetch the inventory item names/quantities on storage location field change, then we store those dropdown options and reuse them whenever a new line item is added.This will make adding new line items more responsive, and with less jank (from the reduced number of ajax calls) (ie. the item name changing from "XL Diapers" to "XL Diapers (1353)").
Type of change
How Has This Been Tested?
Tested manually in Chrome on my local machine, using the reproduction steps provided here.
Testing has been tough. I see a similar issue to the one I'm having where the
input
event isn't being triggered by cuprite. In my case theselect2:select
event isn't being triggered for some reason.