Skip to content

Commit f4594fc

Browse files
fixed cache invalidation for /me, /p, /b and /i i.e. sections (#32)
1 parent 88ec6a9 commit f4594fc

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/open_repo_context.tsx

+6-8
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ function SearchContext({ repository }: SearchContextProps) {
3333
const [firstLoad, setfirstLoad] = useState(true);
3434

3535
const { data, isLoading: isPRLoading } = usePromise(
36-
async (searchText) => {
36+
async (searchText, sections) => {
3737
const result: {
3838
pullRequest?: PullRequestFieldsFragment[] | undefined;
3939
issues?: IssueFieldsFragment[] | undefined;
@@ -50,9 +50,8 @@ function SearchContext({ repository }: SearchContextProps) {
5050
if (sections.includes("/p")) {
5151
const pullRequest = (
5252
await github.searchPullRequests({
53-
query: `is:pr repo:${repository.nameWithOwner} ${
54-
forAuthor ? "author:@me" : ""
55-
} archived:false ${searchText.trim()}`,
53+
query: `is:pr repo:${repository.nameWithOwner} ${forAuthor ? "author:@me" : ""
54+
} archived:false ${searchText.trim()}`,
5655
numberOfItems: n,
5756
})
5857
).search.edges?.map((edge) => edge?.node as PullRequestFieldsFragment);
@@ -62,9 +61,8 @@ function SearchContext({ repository }: SearchContextProps) {
6261
if (sections.includes("/i")) {
6362
const issues = (
6463
await github.searchIssues({
65-
query: `is:issue repo:${repository.nameWithOwner} ${
66-
forAuthor ? "author:@me" : ""
67-
} archived:false ${searchText.trim()}`,
64+
query: `is:issue repo:${repository.nameWithOwner} ${forAuthor ? "author:@me" : ""
65+
} archived:false ${searchText.trim()}`,
6866
numberOfItems: n,
6967
})
7068
).search.nodes?.map((node) => node as IssueFieldsFragment);
@@ -90,7 +88,7 @@ function SearchContext({ repository }: SearchContextProps) {
9088

9189
return result;
9290
},
93-
[searchText],
91+
[searchText, sections],
9492
{
9593
onError(error) {
9694
showToast({

0 commit comments

Comments
 (0)