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

WebGLRenderer: Simplify getContext(). #28186

Merged
merged 1 commit into from
Apr 22, 2024

Conversation

vitch
Copy link
Contributor

@vitch vitch commented Apr 22, 2024

Related issue: N/A

Description

The null check seems to have been redundant.

This code should behave the same as the previous code and return null when context === null or return context otherwise.

Maybe there is a good reason it was like it was (ability to put a debugger on line 227?) in which case feel free to decline this PR - I just came across the code when I was searching for something else and thought I'd clean it up in case it was unnecessarily there based on a historical change...

Sidenote: I tried running npm run lint-fix as mentioned in CONTRIBUTING.md but that changed some unrelated files
so I didn't commit them.

The null check seems to have been redundant.

This code should behave the same as the previous code and return `null` when
`context === null` or return `context` otherwise.

Maybe there is a good reason it was like it was (ability to put a debugger on
line 227?) in which case feel free to decline this PR - I just came across the
code when I was searching for something else and thought I'd clean it up in
case it was unnecessarily there based on a historical change...
Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
674.4 kB (167.1 kB) 674.4 kB (167.1 kB) -24 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
453.8 kB (109.5 kB) 453.8 kB (109.5 kB) -24 B

@Mugen87 Mugen87 added this to the r164 milestone Apr 22, 2024
@Mugen87 Mugen87 merged commit 4d6fa0d into mrdoob:dev Apr 22, 2024
12 checks passed
@Mugen87 Mugen87 changed the title WebGLRenderer: remove redundant code WebGLRenderer: Simplify getContext(). Apr 23, 2024
@mrdoob
Copy link
Owner

mrdoob commented Apr 24, 2024

Seems like we don't even need the getContext() function anymore.

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.

3 participants