diff --git a/src/app/search/page.tsx b/src/app/search/page.tsx
index c1e6ed1f..b5616d3c 100644
--- a/src/app/search/page.tsx
+++ b/src/app/search/page.tsx
@@ -123,9 +123,6 @@ export default function SearchPage() {
size="sm"
defaultQuery={searchQuery}
/>
- {isLoading && (
-
- )}
- {
- setSelectedFile(fileMatch);
- }}
- onMatchIndexChanged={(matchIndex) => {
- setSelectedMatchIndex(matchIndex);
- }}
- />
+ {isLoading ? (
+
+ ) : (
+ {
+ setSelectedFile(fileMatch);
+ }}
+ onMatchIndexChanged={(matchIndex) => {
+ setSelectedMatchIndex(matchIndex);
+ }}
+ />
+ )}
{
+
+ if (fileMatches.length === 0) {
+ return (
+
+ );
+ }
+
return (
{fileMatches.map((fileMatch, index) => (
diff --git a/src/hooks/useExtensionWithDependency.ts b/src/hooks/useExtensionWithDependency.ts
index 7c6a0a4e..d29a521d 100644
--- a/src/hooks/useExtensionWithDependency.ts
+++ b/src/hooks/useExtensionWithDependency.ts
@@ -17,9 +17,17 @@ export function useExtensionWithDependency(
useEffect(() => {
if (view) {
- view.dispatch({
- effects: compartment.reconfigure(extensionFactory()),
- });
+ try {
+ view.dispatch({
+ effects: compartment.reconfigure(extensionFactory()),
+ });
+
+ // @note: we were getting "RangeError: Position X is out of range for changeset of length Y" errors
+ // spuriously for some reason. This is a dirty hack to prevent codemirror from crashing the app
+ // in those cases.
+ } catch (error) {
+ console.error(error);
+ }
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, deps);