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

frontend: remove unsafe componnetwillmount fix esc in webdev #2719

Merged
merged 1 commit into from
May 27, 2024

Conversation

thisconnect
Copy link
Collaborator

When Strict Mode is on, React will also run one extra setup+cleanup cycle in development. This helps reveal subtle bugs that are hard to catch manually. This also makes the deprecated UNSAFE componentWillMount only run first time.

Send view used UNSAFE_componentWillMount to listen to keydown events that handles ESC button. In webdev pressing ESC button did therefore not go back to the account overview.

Changed to register events on componentDidMount.

Also changed deprecated KeyBoardEvent.keyCode to KeyBoardEvent.key.

See:

When Strict Mode is on, React will also run one extra setup+cleanup
cycle in development. This helps reveal subtle bugs that are hard
to catch manually. This also makes the deprecated UNSAFE
componentWillMount only run first time.

Send view used UNSAFE_componentWillMount to listen to keydown
events that handles ESC button. In webdev pressing ESC button did
therefore not go back to the account overview.

Changed to register events on componentDidMount.

Also changed deprecated KeyBoardEvent.keyCode to KeyBoardEvent.key.

See:
- https://react.dev/reference/react/StrictMode
- https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/keyCode
Copy link
Collaborator

@shonsirsha shonsirsha left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@thisconnect thisconnect merged commit 4ae5721 into BitBoxSwiss:master May 27, 2024
5 checks passed
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.

None yet

2 participants