Skip to content

Fix initiative effect sending number instead of string - #1774

Merged
Kruptein merged 3 commits into
Kruptein:devfrom
rexy712:fix-initiative-server-error
Feb 14, 2026
Merged

Kruptein merged 3 commits into
Kruptein:devfrom
rexy712:fix-initiative-server-error

Conversation

@rexy712

@rexy712 rexy712 commented Feb 7, 2026

Copy link
Copy Markdown
Contributor

This is an error I made when making the CreateEffectDialog component. The turn count was made to be an input element with type="number" to give the box the up/down arrows for easy decrement and increment. The problem is that if the user types in a number rather than using the default or the up/down arrows, the resulting type would be a number rather than a string. This caused the server to throw an error and reject the effect.

This PR fixes the issue by making the client side handle the input as a number always, then convert it to a string to send the server. Even using v-model.number with the input box, an empty input box returns "" when submitting, so technically still need to handle that case.

const name = ref("");
const turns = ref<string | null>(defaultTurns);
// need string here because an empty input box still returns an empty string
const turns = ref<number | string | null>(defaultTurns);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need null then?

@Kruptein
Kruptein merged commit ec524e9 into Kruptein:dev Feb 14, 2026
8 checks passed
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