8000 🐞 Modifier set to zero when adding a creature through the modal · Issue #313 · javalent/initiative-tracker · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
🐞 Modifier set to zero when adding a creature through the modal #313
Open
@mahtaran

Description

@mahtaran

Check for existing bug reports before submitting.

  • I searched for existing Bug Reports and found no similar reports.

Expected Behavior

When a creature is added through the modal, the modifier field should be kept as-is

Current behaviour

The modifier field is set to zero after the creature is added. In the modal, it uses the modifier value correctly for the initiative bonus and dice formula, but the actual modifier input is 0. Thus, if you save it, the modifier field is set to 0.

Reproduction

Start an encounter, and open the modal to add a creature. Select any creature with a modifier value, and observe how the modifier field will remain 0.

Which Operating Systems are you using?

  • Android
  • iPhone/iPad
  • Linux
  • macOS
  • Windows

Obsidian Version Check

1.8.4 and 1.8.4

Plugin Version

13.0.16

Confirmation

  • I have disabled all other plugins and the issue still persists.

Possible solution

The problem seems to be that, whereas other inputs are bound to the actual field in the creature object, the modifier input uses a local variable, which is not updated when a creature is selected.

The reason as to why the modifier specifically has a local variable is unknown to me, but I believe it can simply be removed. The only additional benefit I can see it having right now is for validation if the modifier is valid, which should be handled by the check immediately after (side-tangent: wouldn't it be better to stop the saving process and show a notice to the user, like with the name, instead of silently setting the modifier to 0?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0