Fix dropdown menus in custom item builder unable to change from default values #10
+26
−8
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
Dropdown menus in the custom item builder and class selector were stuck on their default values and could not be changed. This affected multiple dropdowns including:
Root Cause
When ClojureScript/Reagent renders keyword values like
:weaponor:armorin HTML select options, React stringifies them to":weapon"and":armor"(preserving the colon character). When the dropdown value is retrieved from the DOM event, it comes back as the string":weapon".Additionally, some code paths dispatch events directly with keyword values (e.g., the batch-set code that sets default weapon properties dispatches with
:simpleand:melee).The original event handlers used
(keyword ...)which had issues:(keyword ":weapon")→::weapon❌ Wrong! (creates namespaced keyword with empty namespace)(keyword :simple)→:simple✓ Works (keyword passthrough)This mismatch caused dropdown selections to fail silently because the stored value never matched what was expected.
Solution
Created a
->keywordhelper function that properly handles both string inputs from dropdowns and keyword inputs from direct dispatch:This ensures:
":weapon"are correctly parsed to:weapon:simpleare passed through unchangedChanges
->keywordhelper function and updated 7 event handlers for item builder dropdowns->keywordhelper function and updated class selector dropdown handlerTotal: 26 insertions(+), 8 deletions(-) - minimal changes that properly handle both dropdown selections and direct event dispatch.
Testing
All affected dropdowns now properly update when users select new values:
Fixes the issue described in the upstream orcpub repository where dropdown menus could not be changed from their default values.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.