Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use change event instead of keyup for node name change #248

Merged

Conversation

emersion
Copy link
Collaborator

Fixes a few issues:

  • "keyup" is not triggered when copy-pasting. So if the user right clicks and pastes a new value, the name would not get updated.
  • "keyup" triggers each time a character is typed in the input field. This results in a lot of operations on each keypress.
  • No need to set this.nodeProperties.nodeBetriebspunktName nor this.nodeProperties.nodeBetriebspunktFullName on keyup: this is already done automatically by [ngModel].

Note that we do loose a bit of functionality with this patch: the diagrams and sidebar headings aren't updated in real-time as the user types anymore. If this is deemed important functionality, we could use (ngModelChange) instead.

Fixes a few issues:

- "keyup" is not triggered when copy-pasting. So if the user right
  clicks and pastes a new value, the name would not get updated.
- "keyup" triggers each time a character is typed in the input
  field. This results in a lot of operations on each keypress.
- No need to set this.nodeProperties.nodeBetriebspunktName nor
  this.nodeProperties.nodeBetriebspunktFullName on keyup: this is
  already done automatically by [ngModel].

Note that we do loose a bit of functionality with this patch: the
diagrams and sidebar headings aren't updated in real-time as the
user types anymore.
@emersion emersion requested a review from aiAdrian as a code owner August 19, 2024 13:43
@emersion emersion requested a review from louisgreiner August 19, 2024 13:43
@louisgreiner
Copy link
Collaborator

Great idea 👍

Copy link
Collaborator

@aiAdrian aiAdrian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@emersion emersion merged commit 1e1177b into SchweizerischeBundesbahnen:main Aug 19, 2024
6 checks passed
@emersion emersion deleted the emr/fix-node-change branch August 19, 2024 15:53
emersion added a commit to OpenRailAssociation/osrd that referenced this pull request Aug 19, 2024
The current approach doesn't work when editing two nodes in
succession: edit node A and before 2s elapse edit node B. The
debounce will only invoke the callback for node B, dropping changes
for node A. Moreover, switching to the micro tab will not
immediately reflect changes.

Instead, NGE has been patched [1] to only trigger the node update
event once the input field is unfocused.

[1]: SchweizerischeBundesbahnen/netzgrafik-editor-frontend#248
emersion added a commit to OpenRailAssociation/osrd that referenced this pull request Aug 19, 2024
The current approach doesn't work when editing two nodes in
succession: edit node A and before 2s elapse edit node B. The
debounce will only invoke the callback for node B, dropping changes
for node A. Moreover, switching to the micro tab will not
immediately reflect changes.

Instead, NGE has been patched [1] to only trigger the node update
event once the input field is unfocused.

[1]: SchweizerischeBundesbahnen/netzgrafik-editor-frontend#248
github-merge-queue bot pushed a commit to OpenRailAssociation/osrd that referenced this pull request Aug 20, 2024
The current approach doesn't work when editing two nodes in
succession: edit node A and before 2s elapse edit node B. The
debounce will only invoke the callback for node B, dropping changes
for node A. Moreover, switching to the micro tab will not
immediately reflect changes.

Instead, NGE has been patched [1] to only trigger the node update
event once the input field is unfocused.

[1]: SchweizerischeBundesbahnen/netzgrafik-editor-frontend#248
Uriel-Sautron pushed a commit to osrd-project/netzgrafik-editor-frontend that referenced this pull request Sep 19, 2024
…rischeBundesbahnen#248)

Fixes a few issues:

- "keyup" is not triggered when copy-pasting. So if the user right
  clicks and pastes a new value, the name would not get updated.
- "keyup" triggers each time a character is typed in the input
  field. This results in a lot of operations on each keypress.
- No need to set this.nodeProperties.nodeBetriebspunktName nor
  this.nodeProperties.nodeBetriebspunktFullName on keyup: this is
  already done automatically by [ngModel].

Note that we do loose a bit of functionality with this patch: the
diagrams and sidebar headings aren't updated in real-time as the
user types anymore.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants