Skip to content

Commit

Permalink
refactor: handle uploading imported evernote attachments note-by-note…
Browse files Browse the repository at this point in the history
… instead of all at once
  • Loading branch information
amanharwara committed Dec 7, 2023
1 parent 620cd96 commit 6d03a8a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
5 changes: 1 addition & 4 deletions packages/ui-services/src/Import/Importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,7 @@ export class Importer {
}

async getPayloadsFromFile(file: File, type: string): Promise<DecryptedTransferPayload[]> {
const isEntitledToSuper =
this.features.getFeatureStatus(
NativeFeatureIdentifier.create(NativeFeatureIdentifier.TYPES.SuperEditor).getValue(),
) === FeatureStatus.Entitled
const isEntitledToSuper = this.isEntitledToSuper()

if (type === 'super' && !isEntitledToSuper) {
throw new Error('Importing Super notes requires a subscription')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,8 @@ export class HeadlessSuperConverter implements SuperConverterServiceInterface {
resolve()
return
}
Promise.all(
concatenatedNodes.map(async (node) => {
;(async () => {
for (const node of concatenatedNodes) {
const blob = await fetch(node.__src).then((response) => response.blob())
const name = $isInlineFileNode(node) ? node.__fileName : node.__alt
const mimeType = $isInlineFileNode(node) ? node.__mimeType : node.__src.split(';')[0].split(':')[1]
Expand All @@ -303,8 +303,8 @@ export class HeadlessSuperConverter implements SuperConverterServiceInterface {
)

await linkFile(uploadedFile)
}),
)
}
})()
.then(() => resolve())
.catch(console.error)
},
Expand Down

0 comments on commit 6d03a8a

Please sign in to comment.