Skip to content

Commit

Permalink
Merge pull request #1481 from blockchain-certificates/chore/bundle-stats
Browse files Browse the repository at this point in the history
perf(bundle): split download pdf logic
  • Loading branch information
lemoustachiste authored Nov 8, 2023
2 parents 048c425 + b0ea582 commit 7e87075
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion bundle-stats.html

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/actions/downloadPDF.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import domain from '../domain';
import updateIsGeneratingPDF from './updateIsGeneratingPDF';
import {
getCertificateTitle,
Expand All @@ -20,6 +19,8 @@ export default function downloadPDF () {
return async function (dispatch: Dispatch, getState: () => BlockcertsVerifierState): Promise<void> {
const state = getState();

const { default: downloadPDF } = await import('../domain/certificates/useCases/downloadPDF');

const contentType: CONTENT_TYPES = getDisplayContentType(state);
const contentEncoding: string = getDisplayContentEncoding(state);
const content: string = getDisplayContent(state);
Expand All @@ -35,7 +36,7 @@ export default function downloadPDF () {

dispatch(updateIsGeneratingPDF(true));

await domain.certificates.downloadPDF({
await downloadPDF({
contentType,
contentEncoding,
content,
Expand Down
3 changes: 1 addition & 2 deletions src/domain/certificates/useCases/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import displayHtmlHasNoWidthConstraint from './displayHtmlHasNoWidthConstraint';
import download from './download';
import downloadPDF from './downloadPDF';
// import downloadPDF from './downloadPDF'; // removed to prefer async import
import initializeVerificationSteps from './initializeVerificationSteps';
import retrieve from './retrieve';
import read from './read';
Expand All @@ -10,7 +10,6 @@ import isPathToCertificateValidURI from './isPathToCertificateValidURI';
export {
displayHtmlHasNoWidthConstraint,
download,
downloadPDF,
initializeVerificationSteps,
retrieve,
read,
Expand Down

0 comments on commit 7e87075

Please sign in to comment.