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

refactor: opt by million #3439

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft

refactor: opt by million #3439

wants to merge 4 commits into from

Conversation

guanbinrui
Copy link
Member

@guanbinrui guanbinrui commented Dec 11, 2024

Pull Request

Description

Related Issue

Closes FW-0000

Checklist

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have added unit tests if applicable.

Copy link

vercel bot commented Dec 11, 2024

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

Name Status Preview Comments Updated (UTC)
firefly-mask-social ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 11, 2024 10:52am

@guanbinrui guanbinrui force-pushed the refactor/million branch 2 times, most recently from bfffdf2 to f9f7f5b Compare December 11, 2024 09:50
@guanbinrui guanbinrui requested review from LeifXu, nuanyang233 and dudu0506 and removed request for LeifXu and nuanyang233 December 11, 2024 10:02
@guanbinrui guanbinrui marked this pull request as ready for review December 11, 2024 10:02
return await decryptMetrics(cipher, signal);
return await decryptMetrics(cipher, signal);
} catch {
return [];
Copy link
Contributor

Choose a reason for hiding this comment

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

EMPTY_LIST

Copy link
Contributor

@swkatmask swkatmask Dec 13, 2024

Choose a reason for hiding this comment

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

Don't do that. We only use EMPTY_LIST/EMPTY_OBJECT inside react components and hooks which follow the immutable principle.

function fn() {
  return condition ? ['mutable', 'array'] : EMPTY_LIST
}

const arr = fn()

// You can't do it for EMPTY_LIST
arr.push('new item')

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