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

Crash caused by ui-widget alt-datetime when using "Now" button and making changes #3516

Closed
4 tasks done
MatinF opened this issue Mar 17, 2023 · 0 comments · Fixed by #3518
Closed
4 tasks done

Crash caused by ui-widget alt-datetime when using "Now" button and making changes #3516

MatinF opened this issue Mar 17, 2023 · 0 comments · Fixed by #3518
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned

Comments

@MatinF
Copy link

MatinF commented Mar 17, 2023

Prerequisites

What theme are you using?

core

Version

5.3

Current Behavior

Browser crashes when trying to use the ui-widget alt-datetime in Live Playground (Chrome browser).

Expected Behavior

The expected behavior is that the form data would update in response to the change in the date time dropdowns

Steps To Reproduce

  1. Open the Live Playground and go to the Date & Time tab
  2. Use the alt-datetime widget to get the current date & time by clicking the "Now" button
  3. Try to change e.g. the month

Environment

- OS: Windows 10 (Live Playground)

Anything else?

No response

@MatinF MatinF added bug needs triage Initial label given, to be assigned correct labels and assigned labels Mar 17, 2023
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 17, 2023
Fixes rjsf-team#3516 by removing the infinite loop caused by two `useEffects()` by moving the code for one into the `onChange` handler
- Updated `AltDateWidget` to switch to a simple `useState()` rather than `useReducer()` and moved the code for one `useEffect()` into the `onChange` handler
  - This change makes the code match the `antd` and `chakra-ui` versions
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 19, 2023
Fixes rjsf-team#3516 by removing the infinite loop caused by two `useEffects()` by adding a new state for the `value` and combining the effects into one
- Updated `AltDateWidget` to stash the `value` in state and combining the two `useEffects()` into a single effect
  - The effect will call `onChange()` when the `state` is ready for change AND it causes a different string than the current `value`
  - If the `lastValue` recorded differs from the `value`, then we record the new `value` and set the `state` to it
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Mar 19, 2023
Fixes rjsf-team#3516 by removing the infinite loop caused by two `useEffects()` by adding a new state for the `value` and combining the effects into one
- Updated `AltDateWidget` to stash the `value` in state and combining the two `useEffects()` into a single effect
  - The effect will call `onChange()` when the `state` is ready for change AND it causes a different string than the current `value`
  - If the `lastValue` recorded differs from the `value`, then we record the new `value` and set the `state` to it
- Updated the `CHANGELOG.md` accordingly
heath-freenome added a commit that referenced this issue Mar 19, 2023
Fixes #3516 by removing the infinite loop caused by two `useEffects()` by adding a new state for the `value` and combining the effects into one
- Updated `AltDateWidget` to stash the `value` in state and combining the two `useEffects()` into a single effect
  - The effect will call `onChange()` when the `state` is ready for change AND it causes a different string than the current `value`
  - If the `lastValue` recorded differs from the `value`, then we record the new `value` and set the `state` to it
- Updated the `CHANGELOG.md` accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs triage Initial label given, to be assigned correct labels and assigned
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant