Skip to content

fix: optimize the assign expression #15177

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

Merged
merged 1 commit into from
Feb 3, 2025
Merged

Conversation

pgliang001
Copy link
Contributor

Here, neither null or undefined again

Before submitting the PR, please make sure you do the following

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • Prefix your PR title with feat:, fix:, chore:, or docs:.
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.
  • If this PR changes code within packages/svelte/src, add a changeset (npx changeset).

Tests and linting

  • Run the tests with pnpm test and lint the project with pnpm lint

Here, neither null or undefined again
@pgliang001
Copy link
Contributor Author

@Rich-Harris @Conduitry pls review the change

@paoloricciuti
Copy link
Member

@Rich-Harris @Conduitry pls review the change

  1. pls don't tag maintainers to review the code submitted 7 minutes ago, especially on a saturday
  2. it would be useful to have more context around this change...what issue is fixing? What is str is null there?
  3. please add a test case for this change

@Rich-Harris
Copy link
Member

Thank you, the change is good since the str == null case has already been accounted for. But yeah, don't ever tag maintainers demanding that they review your code, especially if it's just been submitted. It's extremely rude.

@pgliang001
Copy link
Contributor Author

Thank you, the change is good since the str == null case has already been accounted for. But yeah, don't ever tag maintainers demanding that they review your code, especially if it's just been submitted. It's extremely rude.

Oh sorry, my extremely mistake

Copy link
Member

@Ocean-OS Ocean-OS left a comment

Choose a reason for hiding this comment

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

Why not just text.nodeValue = str ?? '';?

@adiguba
Copy link
Contributor

adiguba commented Feb 2, 2025

Why no even text.nodeValue = str ?

str is already non-null, and the type coercion will be done by the assignment...

@Ocean-OS
Copy link
Member

Ocean-OS commented Feb 2, 2025

Why no even text.nodeValue = str ?

str is already non-null, and the type coercion will be done by the assignment...

Oh wait, yeah! I didn't know it did that.

@dummdidumm dummdidumm merged commit e12fe87 into sveltejs:main 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.

6 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy