Skip to content

WebGLRenderer: Simplify getContext().#28186

Merged
Mugen87 merged 1 commit into
mrdoob:devfrom
vitch:remove-redundant-null-check
Apr 22, 2024
Merged

WebGLRenderer: Simplify getContext().#28186
Mugen87 merged 1 commit into
mrdoob:devfrom
vitch:remove-redundant-null-check

Conversation

@vitch
Copy link
Copy Markdown
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...
@github-actions
Copy link
Copy Markdown

📦 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
@Mugen87 Mugen87 changed the title WebGLRenderer: remove redundant code WebGLRenderer: Simplify getContext(). Apr 23, 2024
@mrdoob
Copy link
Copy Markdown
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