snow-ai 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -118,6 +118,14 @@ const FileList = memo(forwardRef(({ query, selectedIndex, visible, maxItems = 10
|
|
|
118
118
|
return null;
|
|
119
119
|
}
|
|
120
120
|
}), [allFilteredFiles, selectedIndex]);
|
|
121
|
+
// Calculate display index for the scrolling window
|
|
122
|
+
// MUST be before early returns to avoid hook order issues
|
|
123
|
+
const displaySelectedIndex = useMemo(() => {
|
|
124
|
+
return filteredFiles.findIndex((file) => {
|
|
125
|
+
const originalIndex = allFilteredFiles.indexOf(file);
|
|
126
|
+
return originalIndex === selectedIndex;
|
|
127
|
+
});
|
|
128
|
+
}, [filteredFiles, allFilteredFiles, selectedIndex]);
|
|
121
129
|
if (!visible) {
|
|
122
130
|
return null;
|
|
123
131
|
}
|
|
@@ -129,13 +137,6 @@ const FileList = memo(forwardRef(({ query, selectedIndex, visible, maxItems = 10
|
|
|
129
137
|
return (React.createElement(Box, { borderStyle: "round", borderColor: "gray", paddingX: 1, marginTop: 1 },
|
|
130
138
|
React.createElement(Text, { color: "gray" }, "No files found")));
|
|
131
139
|
}
|
|
132
|
-
// Calculate display index for the scrolling window
|
|
133
|
-
const displaySelectedIndex = useMemo(() => {
|
|
134
|
-
return filteredFiles.findIndex((file) => {
|
|
135
|
-
const originalIndex = allFilteredFiles.indexOf(file);
|
|
136
|
-
return originalIndex === selectedIndex;
|
|
137
|
-
});
|
|
138
|
-
}, [filteredFiles, allFilteredFiles, selectedIndex]);
|
|
139
140
|
return (React.createElement(Box, { paddingX: 1, marginTop: 1, flexDirection: "column" },
|
|
140
141
|
React.createElement(Box, { marginBottom: 1 },
|
|
141
142
|
React.createElement(Text, { color: "blue", bold: true },
|