Skip to content

Why is the entire value of a textarea constantly sent to the server on every key press? #4044

Answered by falkoschindler
umarbutler asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @umarbutler,

It was one of NiceGUI's central design decisions to always synchronize state with the server to allow other parts of the code to access current values, handle events, validate inputs etc. In some cases this can indeed cause a significant overhead. Elements like ui.log, ui.scene or ui.codemirror avoid it by sending updates rather than the whole state. And for text areas you can derive your own element from Quasar's QInput and request the current model value on demand:

class MyTextarea(ui.element):
    def __init__(self, value: str = '') -> None:
        super().__init__(tag='q-input')
        self._props['type'] = 'textarea'
        self._props['model-value'] = value

    a…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by umarbutler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants