Skip to content

Commit

Permalink
fix: add null check in updated method of sp-number-field (#4709)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubencarvalho authored Sep 5, 2024
1 parent 9e0cd08 commit 7b1eeab
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/number-field/src/NumberField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,11 @@ export class NumberField extends TextfieldBase {
}

protected override updated(changes: PropertyValues<this>): void {
if (!this.inputElement || !this.isConnected) {
// Prevent race conditions if inputElement is removed from DOM while a queued update is still running.
return;
}

if (changes.has('min') || changes.has('formatOptions')) {
let inputMode = 'numeric';
const hasNegative = typeof this.min !== 'undefined' && this.min < 0;
Expand Down

0 comments on commit 7b1eeab

Please sign in to comment.