Skip to content

added sendingFeedback check to send-feedback#84

Merged
boehlerlukas merged 2 commits intomasterfrom
region-access
Oct 29, 2025
Merged

added sendingFeedback check to send-feedback#84
boehlerlukas merged 2 commits intomasterfrom
region-access

Conversation

@TobiasDuelli
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings October 29, 2025 14:10
Copy link

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 implements a feedback submission debounce mechanism to prevent duplicate submissions and bumps the package version to 15.0.3.

  • Adds a sendingFeedback flag to prevent concurrent feedback submissions
  • Implements a 1-second delay before allowing subsequent feedback submissions
  • Applies code formatting improvements (spacing in catch blocks and indentation)

Reviewed Changes

Copilot reviewed 2 out of 12 changed files in this pull request and generated 3 comments.

File Description
src/GleapFrameManager.js Adds debounce logic with sendingFeedback flag and 1-second timeout to prevent duplicate feedback submissions; includes code formatting fixes
package.json Bumps version from 15.0.2 to 15.0.3

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +607 to +609
setTimeout(() => {
this.sendingFeedback = false;
}, 1000);
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

The sendingFeedback flag is reset in the success handler before the feedback-sent message is sent. If the user closes the widget or navigates away immediately after sending feedback, the flag may reset while the operation is still in progress. Consider resetting the flag after all success-related operations complete, or move the timeout to encompass the entire success flow.

Copilot uses AI. Check for mistakes.
Comment on lines +631 to +638
setTimeout(() => {
this.sendingFeedback = false;

this.sendMessage({
name: "feedback-sending-failed",
data: "Something went wrong, please try again.",
});
GleapEventManager.notifyEvent("error-while-sending");
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

The error handling is delayed by 1 second before notifying the user of the failure. This creates a poor user experience where the UI appears unresponsive for 1 second after an error occurs. The sendingFeedback flag reset should be delayed for debouncing, but the error message and event notification should be sent immediately.

Suggested change
setTimeout(() => {
this.sendingFeedback = false;
this.sendMessage({
name: "feedback-sending-failed",
data: "Something went wrong, please try again.",
});
GleapEventManager.notifyEvent("error-while-sending");
this.sendMessage({
name: "feedback-sending-failed",
data: "Something went wrong, please try again.",
});
GleapEventManager.notifyEvent("error-while-sending");
setTimeout(() => {
this.sendingFeedback = false;

Copilot uses AI. Check for mistakes.
Comment on lines +607 to +609
setTimeout(() => {
this.sendingFeedback = false;
}, 1000);
Copy link

Copilot AI Oct 29, 2025

Choose a reason for hiding this comment

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

The debounce delay of 1000ms is hardcoded in multiple places. Consider extracting this as a named constant (e.g., FEEDBACK_DEBOUNCE_DELAY = 1000) at the class level to improve maintainability and make it easier to adjust if needed.

Copilot uses AI. Check for mistakes.
@boehlerlukas boehlerlukas merged commit 0ead19c into master Oct 29, 2025
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.

2 participants