Skip to content

Conversation

@evnchn
Copy link
Collaborator

@evnchn evnchn commented Nov 12, 2025

Motivation

Reading #4154 and #4828 again, I come to the following conclusion:

  1. Late event registrations are fundamentally misaligned with Vue's design. (reference: Events such as keydown and keyup are not triggered by an ui.input when not assigned directly upon creation #4154 (comment))
  2. Therefore, we do not need to aim for perfect behaviour if late event registrations do occur (so Force Vue re-render on late event registration #4828 (comment) should not matter)
  3. Rather, "best effort patch" and "warning to the user" is the way to go.

Hence this PR.

Implementation

Code is extremely similar to #4828

Before we process the list of elements, we do a check to see if there are any new events sent in by the server.

  • If there is, then:
    • We remove that element from Vue's this.elements
    • We mark that we need to await this.$nextTick();
    • We proceed to await this.$nextTick(); to force the Vue to render without that element
      • Do it ONCE only, for performance
    • In such a way, when we process the list of elements as usual, Vue will be like
      • "hey I haven't seen this element before, let me render it"
  • If there is none, then fine, do nothing.

But on top, I added warnings both in Python-land and JS-land.

Progress

  • I chose a meaningful title that completes the sentence: "If applied, this PR will..."
  • The implementation is complete.
  • Pytests have been added.
  • Documentation is not necessary (warning message self-explanatory).

Final notes

How I read it, #4828 was closed because:

  • Accidental closure
  • Significant merge conflict due to NiceGUI 3.0
  • Focus on perfect behaviour (no focus drops)

Both of which should no longer be blockers, given the new code and new positioning on the issue.

So hopefully this gets a pass. Thanks!

@evnchn evnchn added feature Type/scope: New feature or enhancement review Status: PR is open and needs review ⚪️ minor Priority: Low impact, nice-to-have labels Nov 12, 2025
@falkoschindler falkoschindler added this to the 3.4 milestone Nov 12, 2025
@falkoschindler falkoschindler modified the milestones: 3.4, 3.5 Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Type/scope: New feature or enhancement ⚪️ minor Priority: Low impact, nice-to-have review Status: PR is open and needs review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Events such as keydown and keyup are not triggered by an ui.input when not assigned directly upon creation

2 participants