File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -187,7 +187,7 @@ function updateFromProps() {
187187}
188188
189189async function inputClick() {
190- if (props .readonly && ! props .searchDisabled ) return ;
190+ if (props .readonly || props .searchDisabled ) return ;
191191 // Toggle local dropdown
192192 showDropdown .value = ! showDropdown .value ;
193193 // If the dropdown is about to close, reset the search
@@ -266,7 +266,7 @@ onMounted(() => {
266266
267267const filteredItems = computed (() => {
268268
269- if (! props .searchDisabled ) {
269+ if (props .searchDisabled ) {
270270 return props .options || [];
271271 }
272272
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import sanitizeHtml from 'sanitize-html'
1010import debounce from 'debounce' ;
1111
1212const LS_LANG_KEY = `afLanguage` ;
13+ const MAX_CONSECUTIVE_EMPTY_RESULTS = 2 ;
14+ const ITEMS_PER_PAGE_LIMIT = 100 ;
1315
1416export async function callApi ( { path, method, body= undefined } : {
1517 path : string , method : 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH'
@@ -233,7 +235,7 @@ export function handleForeignResourcePagination(
233235 if ( items . length === 0 ) {
234236 const newEmptyCount = emptyResultsCount + 1 ;
235237 return {
236- hasMore : newEmptyCount < 2 , // Stop loading after 2 consecutive empty results
238+ hasMore : newEmptyCount < MAX_CONSECUTIVE_EMPTY_RESULTS , // Stop loading after 2 consecutive empty results
237239 emptyResultsCount : newEmptyCount
238240 } ;
239241 } else {
@@ -245,7 +247,7 @@ export function handleForeignResourcePagination(
245247 }
246248 } else {
247249 return {
248- hasMore : items . length === 100 ,
250+ hasMore : items . length === ITEMS_PER_PAGE_LIMIT ,
249251 emptyResultsCount : 0
250252 } ;
251253 }
You can’t perform that action at this time.
0 commit comments