@alliance-droid/status-feedback-system 1.3.10 → 1.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -24,6 +24,8 @@ export function createFeedbackBoard(options) {
|
|
|
24
24
|
let voteErrors = $state({});
|
|
25
25
|
// Response cache
|
|
26
26
|
const responseCache = {};
|
|
27
|
+
// Track in-flight votes to prevent duplicate requests
|
|
28
|
+
const pendingVotes = new Set();
|
|
27
29
|
async function load() {
|
|
28
30
|
loading = true;
|
|
29
31
|
error = '';
|
|
@@ -76,6 +78,9 @@ export function createFeedbackBoard(options) {
|
|
|
76
78
|
load();
|
|
77
79
|
});
|
|
78
80
|
async function vote(itemId, direction) {
|
|
81
|
+
if (pendingVotes.has(itemId))
|
|
82
|
+
return;
|
|
83
|
+
pendingVotes.add(itemId);
|
|
79
84
|
const prev = votedItems[itemId];
|
|
80
85
|
// Clear any prior error for this item
|
|
81
86
|
if (voteErrors[itemId]) {
|
|
@@ -103,6 +108,9 @@ export function createFeedbackBoard(options) {
|
|
|
103
108
|
voteErrors = rest;
|
|
104
109
|
}, 3000);
|
|
105
110
|
}
|
|
111
|
+
finally {
|
|
112
|
+
pendingVotes.delete(itemId);
|
|
113
|
+
}
|
|
106
114
|
}
|
|
107
115
|
async function getResponses(itemId) {
|
|
108
116
|
if (responseCache[itemId])
|
package/package.json
CHANGED