Skip to content

Chunked + background uploading #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kaasbroodju
Copy link
Collaborator

No description provided.

@kaasbroodju kaasbroodju requested a review from ddvleeuwen July 21, 2025 23:26
Copy link

vercel bot commented Jul 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
intro-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 22, 2025 2:16pm

Copy link
Owner

@ddvleeuwen ddvleeuwen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please try to fix the build

src/App.tsx Outdated

if ('SyncManager' in window) {
navigator.serviceWorker.ready.then((reg) => {
reg.sync.register('sync-uploads');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vercel geeft de volgende error op deze line:

src/App.tsx(20,25): error TS2339: Property 'sync' does not exist on type 'ServiceWorkerRegistration'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all browser support background uploading. See article: https://developer.mozilla.org/en-US/docs/Web/API/SyncManager

Added own definition based on mdn docs

const registration = await navigator.serviceWorker.ready;

if ('sync' in registration) {
registration.sync.register('sync-uploads');
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TS error here:

src/services/challenge.service.tsx(61,7): error TS18046: 'registration.sync' is of type 'unknown'.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not all browser support background uploading. See article: https://developer.mozilla.org/en-US/docs/Web/API/SyncManager

Added own definition based on mdn docs

Comment on lines +102 to +109
await db.uploads.add({
challengeId,
attemptId,
chunkIndex: String(chunkIndex),
fileName,
fileType,
data: await chunk.arrayBuffer(),
});
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another typescript error somewhere along here.

src/services/challenge.service.tsx(51,7): error TS2322: Type 'number' is not assignable to type 'string'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants