Skip to content

Commit

Permalink
Fork Repositories: Workaround for Open in Fork only opening Fork, b…
Browse files Browse the repository at this point in the history
…ut not the repo, when Fork isn't running. (#11659)
  • Loading branch information
sxn authored Apr 5, 2024
1 parent 4025ba6 commit fe7fff3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 4 additions & 0 deletions extensions/fork-repositories/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Fork Repositories Changelog

## [Bug Fix] - 2024-04-05

- Fixed an issue where `Open in Fork` would properly open Fork, but not the the target repository.

## [Redesign] - 2023-06-19

- Updated `@raycast/api` to latest version
Expand Down
14 changes: 12 additions & 2 deletions extensions/fork-repositories/src/fork-repositories.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionPanel, Detail, List, Action, Color } from "@raycast/api";
import { ActionPanel, Detail, List, Action, open } from "@raycast/api";
import { dirname } from "node:path";
import tildify from "./vendor/tildify";
import { useRepos, useHasApplication } from "./hooks";
Expand Down Expand Up @@ -57,7 +57,17 @@ const Command = () => {
actions={
<ActionPanel>
<ActionPanel.Section>
<Action.Open title="Open in Fork" icon="icon.png" target={path} application={FORK_BUNDLE_ID} />
<Action
title="Open in Fork"
icon="icon.png"
onAction={async () => {
// For some reason, if this action is used when Fork isn't running, it'll result in
// the app being started, but not the repo actually being opened.
// So to work around that, we call `open` twice 🤷
await open(path, FORK_BUNDLE_ID);
await open(path, FORK_BUNDLE_ID);
}}
/>
<Action.OpenWith path={path} />
<Action.ShowInFinder path={path} />
</ActionPanel.Section>
Expand Down

0 comments on commit fe7fff3

Please sign in to comment.