fix: update field event is not sent when input event does not occur in inline editable fields#411
Merged
faraazb merged 2 commits intodevelop_v3from Apr 4, 2025
Merged
Conversation
…n inline editable fields A global state is used to track whether an input event was handled in the focussed field.
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR fixes an issue where the update field event is not sent when an input event does not occur in inline editable fields by introducing and managing a global state flag (focusFieldReceivedInput). Key changes include:
- Updating the handleFieldInput function to set focusFieldReceivedInput to true upon an input event.
- Adding a new test case to verify that focusFieldReceivedInput is properly updated.
- Integrating the focusFieldReceivedInput flag in the generateOverlay functionality to conditionally trigger field events.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/visualBuilder/utils/handleFieldMouseDown.ts | Sets focusFieldReceivedInput based on input events |
| src/visualBuilder/utils/test/handleFieldMouseDown.test.ts | Adds tests verifying focusFieldReceivedInput state updates |
| src/visualBuilder/index.ts | Introduces focusFieldReceivedInput in the global state |
| src/visualBuilder/generators/generateOverlay.tsx | Uses focusFieldReceivedInput to conditionally trigger field update events |
Comments suppressed due to low confidence (2)
src/visualBuilder/utils/handleFieldMouseDown.ts:23
- [nitpick] Consider setting 'focusFieldReceivedInput' to true unconditionally if the intent is to flag an input event, unless there is a specific reason for the conditional check to avoid redundant state updates.
if (!VisualBuilder.VisualBuilderGlobalState.value.focusFieldReceivedInput) {
src/visualBuilder/generators/generateOverlay.tsx:141
- [nitpick] It might be helpful to add an inline comment explaining why focusFieldReceivedInput is reset here to improve code clarity and future maintainability.
VisualBuilder.VisualBuilderGlobalState.value.focusFieldReceivedInput = false;
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||||||||||||||
sairajchouhan
approved these changes
Apr 4, 2025
Contributor
sairajchouhan
left a comment
There was a problem hiding this comment.
tested locally works well
LGTM 🚀
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A global state is used to track whether an input event was handled in the focused field.