mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-02-12 16:52:51 +00:00
Make suggestion limit configurable and remove redundant .take(10) from widget
Move hardcoded suggestion limit to kNSIMaxSuggestions in dev_config, and remove the redundant .take(10) from optionsBuilder since the fetch stage already caps results. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -144,6 +144,7 @@ const int kDefaultMaxNodes = 500; // Default maximum number of nodes to render o
|
||||
|
||||
// NSI (Name Suggestion Index) configuration
|
||||
const int kNSIMinimumHitCount = 500; // Minimum hit count for NSI suggestions to be considered useful
|
||||
const int kNSIMaxSuggestions = 10; // Maximum number of tag value suggestions to fetch and display
|
||||
|
||||
// Map interaction configuration
|
||||
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)
|
||||
|
||||
@@ -84,8 +84,7 @@ class NSIService {
|
||||
}
|
||||
}
|
||||
|
||||
// Limit to top 10 suggestions for UI performance
|
||||
if (suggestions.length >= 10) break;
|
||||
if (suggestions.length >= kNSIMaxSuggestions) break;
|
||||
}
|
||||
|
||||
return suggestions;
|
||||
|
||||
@@ -110,12 +110,9 @@ class _NSITagValueFieldState extends State<NSITagValueField> {
|
||||
focusNode: _focusNode,
|
||||
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||
if (_suggestions.isEmpty) return const Iterable<String>.empty();
|
||||
if (textEditingValue.text.isEmpty) {
|
||||
return _suggestions.take(10);
|
||||
}
|
||||
if (textEditingValue.text.isEmpty) return _suggestions;
|
||||
return _suggestions
|
||||
.where((s) => s.contains(textEditingValue.text))
|
||||
.take(10);
|
||||
.where((s) => s.contains(textEditingValue.text));
|
||||
},
|
||||
onSelected: (String selection) {
|
||||
widget.onChanged(selection);
|
||||
|
||||
Reference in New Issue
Block a user