Skip to content

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
VE-5361-no-update-on-no-input
Apr 4, 2025
Merged

fix: update field event is not sent when input event does not occur in inline editable fields#411
faraazb merged 2 commits intodevelop_v3from
VE-5361-no-update-on-no-input

Conversation

@faraazb
Copy link
Copy Markdown
Contributor

@faraazb faraazb commented Mar 28, 2025

A global state is used to track whether an input event was handled in the focused field.

…n inline editable fields

A global state is used to track whether an input event was handled in the focussed field.
@faraazb faraazb requested a review from a team as a code owner March 28, 2025 12:43
@faraazb faraazb requested review from Copilot and hiteshshetty-dev and removed request for a team March 28, 2025 12:43
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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;

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 28, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 81.56% 6849 / 8397
🔵 Statements 81.56% 6849 / 8397
🔵 Functions 75.54% 244 / 323
🔵 Branches 85.7% 863 / 1007
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/visualBuilder/index.ts 61.17% 84.61% 42.85% 61.17% 79-86, 89-90, 93-102, 105-178, 184-215
src/visualBuilder/generators/generateOverlay.tsx 89.94% 77.27% 100% 89.94% 130-139, 176, 194-197, 221-224
src/visualBuilder/utils/handleFieldMouseDown.ts 100% 92% 100% 100%
Generated in workflow #354 for commit 7aecf09 by the Vitest Coverage Report Action

Base automatically changed from develop_v3 to stage_v3 April 1, 2025 11:06
@faraazb faraazb changed the base branch from stage_v3 to develop_v3 April 2, 2025 11:57
Copy link
Copy Markdown
Contributor

@csAyushDubey csAyushDubey left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Copy Markdown
Contributor

@sairajchouhan sairajchouhan left a comment

Choose a reason for hiding this comment

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

tested locally works well
LGTM 🚀

@faraazb faraazb merged commit 77eb315 into develop_v3 Apr 4, 2025
8 checks passed
@faraazb faraazb deleted the VE-5361-no-update-on-no-input branch April 4, 2025 11:24
@faraazb faraazb restored the VE-5361-no-update-on-no-input branch April 14, 2025 11:56
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.

5 participants