Skip to content

Fix missing dice/damage fields on roll dialog for copied spells - #353

Merged
HarmlessHarm merged 4 commits into
mainfrom
hotfix/spell-copied-rolls-no-dice
Aug 7, 2026
Merged

Fix missing dice/damage fields on roll dialog for copied spells#353
HarmlessHarm merged 4 commits into
mainfrom
hotfix/spell-copied-rolls-no-dice

Conversation

@HarmlessHarm

@HarmlessHarm HarmlessHarm commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes the roll dialog (New roll / Edit roll) not showing the Damage type, Dice count, Dice type, Fixed value and Primary fields when a custom spell is created via Copy existing Spell — for new actions, new rolls, and rolls that came with the copied spell.
  • Root cause: action_options() in hk-action-roll-form.vue used this.options || [""]. An empty array is truthy in JS, so when a spell's options field is [] (which the compendium API returns for spells that don't use the versatile-options feature), the fallback never kicked in and the q-tab-panel loop holding those fields rendered zero panels.
  • Also adds an investigation report at .planning/spell-copied-rolls-no-dice.md documenting the root cause analysis.

Changes

  • src/components/hk-components/hk-action-rolls/hk-action-roll-form.vue: fall back to [""] when options is empty, not just when it's falsy.
  • .planning/spell-copied-rolls-no-dice.md: investigation report.

Since hk-action-roll-form.vue is shared with NPC actions, this also resolves the same latent issue there.

Test plan

  • Copy an existing spell (custom or SRD) whose source has no versatile options set, open an existing roll on a copied action, confirm Damage type / Dice count / Dice type / Fixed value / Primary fields are visible.
  • Add a new action + new roll to a copied spell, confirm the same fields are visible.
  • Create a spell from scratch, confirm fields still work as before (no regression).
  • Verify a spell that legitimately uses multiple options (e.g. versatile weapon) still renders one tab per option correctly.

Generated by Claude Code

claude added 2 commits August 7, 2026 10:09
…mage fields

Traces the bug to action_options() in hk-action-roll-form.vue using
`this.options || [""]`, which treats an empty options array (truthy in
JS) the same as a populated one instead of falling back, so the
damage-type/dice q-tab-panel loop renders zero panels whenever a
copied spell's top-level options array is [].
action_options() used `this.options || [""]`, which treats an empty
options array as populated since empty arrays are truthy in JS. The
compendium API returns options: [] for spells without versatile
options, so copying any such spell produced zero q-tab-panels and
hid the damage type, dice count/type, fixed value and primary fields
for every action and roll on the copy.
@HarmlessHarm
HarmlessHarm changed the base branch from main to develop August 7, 2026 11:51
@HarmlessHarm
HarmlessHarm changed the base branch from develop to main August 7, 2026 11:52
claude added 2 commits August 7, 2026 11:53
The staging workflow only triggered pull_request builds against
develop, so hotfix/* PRs targeting main (per our Git Flow) never got
a staging build to validate against. Add main as a pull_request base
and gate the job so it only runs for main-targeted PRs when the head
branch is hotfix/*, leaving other PR bases and plain pushes to main
untouched.
@HarmlessHarm
HarmlessHarm merged commit fe73d33 into main Aug 7, 2026
1 of 2 checks passed
@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

Successfully merging this pull request may close these issues.

2 participants