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 () {
150150 } , [ success , showModal ] ) ;
151151
152152 const continuousValue = useRef < string [ ] > ( [ ] ) ;
153+ const seenSetRef = useRef < Set < string > > ( new Set ( ) ) ;
153154
154155 const handleUpdate = ( err : any , result : any ) => {
155156 if ( result ) {
156157 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+ }
158166 const val = props . uniqueData
159167 ? [ ...new Set ( continuousValue . current ) ]
160168 : continuousValue . current ;
@@ -205,6 +213,7 @@ const ScannerTmpComp = (function () {
205213 props . onEvent ( "click" ) ;
206214 setShowModal ( true ) ;
207215 continuousValue . current = [ ] ;
216+ seenSetRef . current = new Set ( ) ;
208217 } }
209218 >
210219 < span > { props . text } </ span >
You can’t perform that action at this time.
0 commit comments