mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-08-16 16:10:20 +02: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:
co-authored by
Claude Opus 4.6
parent
ef6fc1c9c8
commit
ef4205f4bd
@@ -144,6 +144,7 @@ const int kDefaultMaxNodes = 500; // Default maximum number of nodes to render o
|
|||||||
|
|
||||||
// NSI (Name Suggestion Index) configuration
|
// NSI (Name Suggestion Index) configuration
|
||||||
const int kNSIMinimumHitCount = 500; // Minimum hit count for NSI suggestions to be considered useful
|
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
|
// Map interaction configuration
|
||||||
const double kNodeDoubleTapZoomDelta = 1.0; // How much to zoom in when double-tapping nodes (was 1.0)
|
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 >= kNSIMaxSuggestions) break;
|
||||||
if (suggestions.length >= 10) break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return suggestions;
|
return suggestions;
|
||||||
|
|||||||
@@ -110,12 +110,9 @@ class _NSITagValueFieldState extends State<NSITagValueField> {
|
|||||||
focusNode: _focusNode,
|
focusNode: _focusNode,
|
||||||
optionsBuilder: (TextEditingValue textEditingValue) {
|
optionsBuilder: (TextEditingValue textEditingValue) {
|
||||||
if (_suggestions.isEmpty) return const Iterable<String>.empty();
|
if (_suggestions.isEmpty) return const Iterable<String>.empty();
|
||||||
if (textEditingValue.text.isEmpty) {
|
if (textEditingValue.text.isEmpty) return _suggestions;
|
||||||
return _suggestions.take(10);
|
|
||||||
}
|
|
||||||
return _suggestions
|
return _suggestions
|
||||||
.where((s) => s.contains(textEditingValue.text))
|
.where((s) => s.contains(textEditingValue.text));
|
||||||
.take(10);
|
|
||||||
},
|
},
|
||||||
onSelected: (String selection) {
|
onSelected: (String selection) {
|
||||||
widget.onChanged(selection);
|
widget.onChanged(selection);
|
||||||
|
|||||||
Reference in New Issue
Block a user