First Check
Example Code
@ui.refreshable
def show_input():
ui.input()
show_input()
ui.button('Refresh', on_click=show_input.refresh)
Description
When using ui.input() inside a @ui.refreshable, clicking the Refresh button causes a TypeError in the browser console.
Steps to reproduce:
- Run the example code above.
- Type something into the input field.
- Click the "Refresh" button.
Expected: The input refreshes without errors.
Actual: A JavaScript error is thrown:
TypeError: Cannot read properties of undefined (reading 'props')
This happens in input.js at the beforeUnmount hook (line 31). When a refreshable rebuilds its content, the element may already be removed from mounted_app.elements by the time Vue's beforeUnmount fires. The code assumes mounted_app.elements[this.$props.id.slice(1)] always exists, but it can be undefined.
NiceGUI Version
3.7.1
Python Version
3.10.19
Browser
Chrome
Operating System
Linux
First Check
Example Code
Description
When using
ui.input()inside a@ui.refreshable, clicking the Refresh button causes aTypeErrorin the browser console.Steps to reproduce:
Expected: The input refreshes without errors.
Actual: A JavaScript error is thrown:
This happens in
input.jsat thebeforeUnmounthook (line 31). When a refreshable rebuilds its content, the element may already be removed frommounted_app.elementsby the time Vue'sbeforeUnmountfires. The code assumesmounted_app.elements[this.$props.id.slice(1)]always exists, but it can beundefined.NiceGUI Version
3.7.1
Python Version
3.10.19
Browser
Chrome
Operating System
Linux