Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Sidecar URL issues fixed across spotlight #558

Merged
merged 4 commits into from
Nov 14, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
some fixes after review comments.
  • Loading branch information
Shubhdeep12 committed Nov 14, 2024
commit 278aa2894c146913b0971489449bb53512883718
5 changes: 3 additions & 2 deletions packages/overlay/src/components/OpenInEditor.tsx
Original file line number Diff line number Diff line change
@@ -4,8 +4,9 @@ import { useSpotlightContext } from '~/lib/useSpotlightContext';
import { ReactComponent as PenIcon } from '../assets/pen.svg';

export default function OpenInEditor({ file }: { file: string }) {
const { sidecarUrl } = useSpotlightContext();
const sidecarOpenUrl: string = new URL('/open', sidecarUrl).href;
const { getSidecarUrl } = useSpotlightContext();
const sidecarOpenUrl: string = getSidecarUrl('/open');

const openInEditor = useCallback(
(evt: React.MouseEvent) => {
fetch(sidecarOpenUrl, {
6 changes: 5 additions & 1 deletion packages/overlay/src/lib/useSpotlightContext.tsx
Original file line number Diff line number Diff line change
@@ -17,5 +17,9 @@ export const SpotlightContextProvider: React.FC<{
};

export const useSpotlightContext = () => {
return useContext(Context);
const context = useContext(Context);
const getSidecarUrl = (path = '') => {
return new URL(path, context.sidecarUrl).href;
};
return { ...context, getSidecarUrl };
};
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ Set this option if you have the sidecar running on another URL than the default

```ts
init({
sidecarUrl: 'http://localhost:8969/sidecar',
sidecarUrl: 'http://localhost:8969/stream',
});
```

Loading