mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-19 12:10:37 +09:00
Fix rebased issue detail prefetch typing
This commit is contained in:
parent
e59047187b
commit
0cb42f49ea
2 changed files with 3 additions and 13 deletions
|
|
@ -84,23 +84,14 @@ describe("issueDetailCache", () => {
|
||||||
expect(queryClient.getQueryData(queryKeys.issues.detail(issue.id))).toEqual(issue);
|
expect(queryClient.getQueryData(queryKeys.issues.detail(issue.id))).toEqual(issue);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("prefetches with the provided issue snapshot before the network result lands", async () => {
|
it("prefetches with the provided issue snapshot without forcing a fresh fetch", async () => {
|
||||||
const issue = createIssue();
|
const issue = createIssue();
|
||||||
let releaseFetch: (() => void) | null = null;
|
|
||||||
vi.mocked(issuesApi.get).mockImplementation(
|
|
||||||
() =>
|
|
||||||
new Promise<Issue>((resolve) => {
|
|
||||||
releaseFetch = () => resolve(issue);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
const prefetchPromise = prefetchIssueDetail(queryClient, issue.identifier!, { issue });
|
await prefetchIssueDetail(queryClient, issue.identifier!, { issue });
|
||||||
|
|
||||||
expect(getCachedIssueDetail(queryClient, issue.identifier)).toEqual(issue);
|
expect(getCachedIssueDetail(queryClient, issue.identifier)).toEqual(issue);
|
||||||
expect(getCachedIssueDetail(queryClient, issue.id)).toEqual(issue);
|
expect(getCachedIssueDetail(queryClient, issue.id)).toEqual(issue);
|
||||||
|
expect(issuesApi.get).not.toHaveBeenCalled();
|
||||||
releaseFetch?.();
|
|
||||||
await prefetchPromise;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("hydrates both cache aliases from a fetched issue detail response", async () => {
|
it("hydrates both cache aliases from a fetched issue detail response", async () => {
|
||||||
|
|
|
||||||
|
|
@ -1651,7 +1651,6 @@ export function IssueDetail() {
|
||||||
<Link
|
<Link
|
||||||
to={createIssueDetailPath(ancestor.identifier ?? ancestor.id)}
|
to={createIssueDetailPath(ancestor.identifier ?? ancestor.id)}
|
||||||
state={resolvedIssueDetailState ?? location.state}
|
state={resolvedIssueDetailState ?? location.state}
|
||||||
issuePrefetch={ancestor}
|
|
||||||
onClickCapture={() =>
|
onClickCapture={() =>
|
||||||
rememberIssueDetailLocationState(
|
rememberIssueDetailLocationState(
|
||||||
ancestor.identifier ?? ancestor.id,
|
ancestor.identifier ?? ancestor.id,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue