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

Webview cleanup #18647

Merged
merged 8 commits into from
Feb 12, 2025
Merged

Webview cleanup #18647

merged 8 commits into from
Feb 12, 2025

Conversation

Benjin
Copy link
Contributor

@Benjin Benjin commented Feb 11, 2025

I noticed some inconsistencies in how we were building webviews, and brought everything into alignment:

  • contexts are all named context, states are all named state; before, we were mixing the names which led to some confusing code snippets where a variable named state was not actually the state.
  • contextProp interfaces and providerProp interfaces are now consistently named across all webviews; similarly, we were calling some things that weren't state "state"
  • removing unnecessary null propagation and non-null-assertion operators; instead, we should be checking that context is defined and returning if not.
    • We should only use myVar!.something if the type checker is unable to figure out that it's not null/undefined on its own. Usually, we should add checks to help the type checker along. Using a non-null assertion operator is a yellow flag that something may be wrong.
  • Promoted instances where we had an explicit provider property in the context so that all the RPC functions for the webview are accessible directly.
    • This one isn't fixing an issue, just bringing things into alignment. I could've also done the opposite, and "demoted" the RPC definitions where they were directly under the context object. Happy to go either way, but we should keep consistent to make future work and debugging simpler. Any opinions?

Copy link

PR Changes

Category Main Branch PR Branch Difference
Code Coverage 50.45% 50.60% $${\color{lightgreen} .15\% }$$
VSIX Size 12144 KB 12142 KB $${\color{lightgreen} -2 KB \space (0\%) }$$
Webview Bundle Size 3176 KB 3176 KB $${\color{lightgreen} 0 KB \space (0\%) }$$

@aasimkhan30
Copy link
Contributor

Looks good to me. Thanks for cleaning the code!

@Benjin Benjin merged commit 974c72c into main Feb 12, 2025
6 checks passed
@Benjin Benjin deleted the dev/benjin/cleanUpContext branch February 12, 2025 20:01
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