skymp
skymp copied to clipboard
[Bug][skyrim-platform]: Editing text widgets inside "on('update')" block results in two text widgets being created, each overlapping
Severity
Major. A crucial error that indicates a deviation from business logic or disrupts the program, but doesn't have a vital impact on the app.
Priority
Medium. Anything that negatively affects the user experience.
Description
I am creating text widgets based on the player's button inputs. When editing text widgets inside an "on('update')" block, with the "setTextString" command, the original text widget doesn't change and instead a new one is created on top of the old one. Additionally, attempting to "destroyText" and then "createText" instead of "setTextString" results in the same thing. However, in the block, if I "destroyText" at one instance in time, say by listening to a hotkey, then at another instance of time, another hotkey, "createText" does nothing. It appears when trying to edit or destroy and create a text widget in the same frame works, but working in different frames results in issues. I have "browser.setFocused(true)" but I've tested with "focus" set to false and the same issue occurs. Further, recreating the code inside "on('buttonEvent')" doesn't result in any issues, but it's harder to use because with "browser.setFocused(true)" the 'buttonEvent' event stops firing.
OS
windows
OS version
10
Skyrim version
1.5.97.08
SKSE version
2.0.29
client commit''s hash
SP 2.6 from Nexus
server commit''s hash
NA
Videocard model
RTX 2080 TI
Steps to reproduce
Create an "on('update')" block, with conditionals for creating and editing text
on('update', () => {
if ( key1) { createText(sometext) } //creates the widget
if (key2) { editText(othertext) } // creates another widget on top of the first one
if (key3) { destroyText(id) } // does NOT destroy the text widget
}
This works though
on('update', () => {
if ( key1) {
createText(sometext);
editText(othertext);
destroyText(id);
}
}
And this works as well
on('buttonEvent', () => {
if ( key1) { createText(sometext) } //creates the widget
if (key2) { editText(othertext) } // correctly edits text
if (key3) { destroyText(id) } // correctly destroys widget
}
Expected result
The original text widget should change accordingly, no matter when the commands are called.
Actual result
An additional text widget is created!