File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
client/packages/lowcoder/src/comps/comps/buttonComp Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -150,11 +150,19 @@ const ScannerTmpComp = (function () {
150
150
} , [ success , showModal ] ) ;
151
151
152
152
const continuousValue = useRef < string [ ] > ( [ ] ) ;
153
+ const seenSetRef = useRef < Set < string > > ( new Set ( ) ) ;
153
154
154
155
const handleUpdate = ( err : any , result : any ) => {
155
156
if ( result ) {
156
157
if ( props . continuous ) {
157
- continuousValue . current = [ ...continuousValue . current , result . text ] ;
158
+ const scannedText : string = result . text ;
159
+ if ( props . uniqueData && seenSetRef . current . has ( scannedText ) ) {
160
+ return ;
161
+ }
162
+ continuousValue . current = [ ...continuousValue . current , scannedText ] ;
163
+ if ( props . uniqueData ) {
164
+ seenSetRef . current . add ( scannedText ) ;
165
+ }
158
166
const val = props . uniqueData
159
167
? [ ...new Set ( continuousValue . current ) ]
160
168
: continuousValue . current ;
@@ -205,6 +213,7 @@ const ScannerTmpComp = (function () {
205
213
props . onEvent ( "click" ) ;
206
214
setShowModal ( true ) ;
207
215
continuousValue . current = [ ] ;
216
+ seenSetRef . current = new Set ( ) ;
208
217
} }
209
218
>
210
219
< span > { props . text } </ span >
You can’t perform that action at this time.
0 commit comments