Skip to content

Commit

Permalink
fix: Pagenumber button not updated correctly #2468
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Jun 4, 2023
1 parent 9cc0ebe commit db19510
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion webui/src/ButtonRenderCache.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,14 @@ export class ButtonRenderCache extends EventEmitter {
}

bankChange(page, bank, render) {
page = Number(page)
bank = Number(bank)
if (isNaN(page) || isNaN(bank)) return

const newImage = dataToButtonImage(render)

const subsForPage = this.#pageSubs[page]
if (subsForPage && subsForPage.size) {
const newImage = dataToButtonImage(render)
const newImages = {
...this.#pageRenders[page],
[bank]: newImage,
Expand All @@ -38,6 +43,14 @@ export class ButtonRenderCache extends EventEmitter {

// TODO - debounce?
this.emit('page', page, newImages)
}

const id = CreateBankControlId(page, bank)
const subsForBank = this.#bankSubs[id]
if (subsForBank && subsForBank.size > 0) {
this.#bankRenders[id] = newImage

// TODO - debounce?
this.emit('bank', page, bank, newImage)
}
}
Expand Down

0 comments on commit db19510

Please sign in to comment.