-
Notifications
You must be signed in to change notification settings - Fork 6
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
Mockup speed enhancement #123
Mockup speed enhancement #123
Conversation
@pkong-ds I'm still removing some scripts that are no longer used, but I think you can see if there are any big issues with this update first |
d723a25
to
60f9213
Compare
60f9213
to
9958292
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, seems many comments. Can huddle if any misunderstanding
public/scripts/upload.js
Outdated
@@ -72,68 +33,93 @@ function getMaxWorkers() { | |||
return navigator.hardwareConcurrency; | |||
} | |||
|
|||
function runPreviewWorker(worker, imageUpload) { | |||
function runWorker(worker, imageUpload, orientationIndex, mode) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the API still be runPreviewWorker
and runWorker
as 2 function?
That way the logic is contained inside each function, and no need to if (preview) else (generate)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same logic - can we also refactor as functions like onPreviewError
, onPreviewSuccess
?
Even better - different files for different complex logic
I planned to separate this holy 1000-line file into multiple files yesterday, but realized
- need to move upload.js into src/pages first ; which means
- need to change all CDN into package :sadfrog:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pkong-ds yes, I think it's better if we can do this after changing all CDN into package, and event typescript
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As per offline discussion, let's do the refactoring while upload.js
is moved
e21d973
to
0d4190b
Compare
e74aea9
to
a6d94ac
Compare
f3b9d6e
to
23d9fcd
Compare
@pkong-ds all updated |
e4bcf46
to
1bbb947
Compare
Thanks for addressing all the comments 👍 I pushed 2 commits to fix some minor stuff. But I observe a bug (or expected behavior?) when testing this branch locally - if I upload more than 5 files, some orientations are lost. I can reproduce this very consistently. Can you help check check? 🙏 6 images uploaded, only 8 files outputScreen.Recording.2024-08-30.at.3.17.56.AM.mp4 |
@pkong-ds Fixed! I found that's because we add event listener in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@YayunHuang Thanks a lot for your work🙏 🙏 LGTM
Ref: MUP-179
demo video: https://linear.app/oursky/issue/MUP-179/mockup-generation-speed-enhancement#comment-ad48fbd1