Skip to content
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

chore(editor-upload): use new asset infra in serlo.org production #4442

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

elbotho
Copy link
Member

@elbotho elbotho commented Jan 31, 2025

No description provided.

Copy link

vercel bot commented Jan 31, 2025

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

Name Status Preview Updated (UTC)
frontend ✅ Ready (Inspect) Visit Preview Feb 3, 2025 10:47am

Copy link
Contributor

github-actions bot commented Jan 31, 2025

📦 Next.js Bundle Analysis for @serlo/frontend

This analysis was generated by the Next.js Bundle Analysis action. 🤖

Seven Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/___editor_preview 200.79 KB (-13 B) 306.17 KB
/entity/create/[type]/[taxonomyId] 222.49 KB (-13 B) 327.87 KB
/entity/repository/add-revision/[...id] 222.15 KB (-13 B) 327.53 KB
/page/create 222.16 KB (-13 B) 327.54 KB
/taxonomy/term/create/[parent_id]/[id] 221.86 KB (-13 B) 327.24 KB
/taxonomy/term/update/[id] 221.78 KB (-13 B) 327.16 KB
/user/settings 223.94 KB (-13 B) 329.32 KB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

@elbotho elbotho marked this pull request as ready for review January 31, 2025 15:29
@elbotho elbotho requested a review from hejtful January 31, 2025 15:29
@elbotho elbotho changed the title chore(editor-upload): use new infra in serlo.org production chore(editor-upload): use new asset infra in serlo.org production Jan 31, 2025
@elbotho elbotho requested a review from kulla January 31, 2025 15:30
Copy link
Contributor

@hejtful hejtful left a comment

Choose a reason for hiding this comment

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

Thanks!

return shouldUseNewUpload() ? uploader : oldUploader
const uploader = (file: File) =>
uploadFile({ file, editorVariant, userId, isSerlo })
return shouldUseNewUpload(isSerlo) ? uploader : oldUploader
}

// while testing
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this obsolete now?

Also the console.log('using new upload method and temporary bucket') line?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wish :)
I think it's not because there are integrations outside of serlo.org that are not staging/dev and I want to activate this for serlo.org production only right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I only meant the // while testing comment and the console log. Might be confusing, if we're using it on production now.

Same for integrations, the console log is not super informative without context.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ahh I see.
On Serlo the console.log won't trigger (early return).
But I moved the comment down so it's a bit more clear.
I'd keep the console.log for now for us to check which method is active when working with integrations.

process.env.NODE_ENV === 'development'
? 'editor.serlo.dev'
: 'editor.serlo.dev' // TODO: Change to production bucket after testing
const isSerloProduction = process.env.NEXT_PUBLIC_ENV === 'production'
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to mention that I added a helper hook to #4348 , in the packages/editor/src/core/hooks/use-is-serlo.ts file, when merging staging to that branch:

export function useIsNextjsProduction(): boolean {
  return process.env.NEXT_PUBLIC_ENV === 'production'
}

So this will be duplicated once both PRs are merged.

@elbotho elbotho merged commit ee43597 into staging Feb 3, 2025
8 checks passed
@elbotho elbotho deleted the feat/new-asset-upload-on-serlo-org-prod branch February 3, 2025 11:00
@github-actions github-actions bot mentioned this pull request Feb 3, 2025
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