virtual icon indicating copy to clipboard operation
virtual copied to clipboard

feat(virtual-core): optimization memo function inner logic

Open taylous opened this issue 9 months ago • 3 comments

summary

  1. the condition opts.key && opts.debug?.() was repeated multiple times, so I assigned it to a variable for reuse.
  2. for the const depsChanged = ... expression, i extracted it into a separate function instead of assigning it to a variable, to improve readability.
  3. i also replaced the pad function with String(...).padStart(...) to prevent unnecessary creation and enhance clarity.

if this PR gets approved, it might be better to move isDepsChanged to a different file instead of utils.ts, since all functions in utils.ts are meant to be exported and publicly usable.

taylous avatar Apr 06 '25 16:04 taylous

⚠️ No Changeset found

Latest commit: abcda379f515d2a0921bb2b1b2bf2e475607d564

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

changeset-bot[bot] avatar Apr 06 '25 16:04 changeset-bot[bot]

View your CI Pipeline Execution ↗ for commit abcda379f515d2a0921bb2b1b2bf2e475607d564.

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 29s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded 18s View ↗

☁️ Nx Cloud last updated this comment at 2025-04-06 16:06:51 UTC

nx-cloud[bot] avatar Apr 06 '25 16:04 nx-cloud[bot]

More templates

@tanstack/angular-virtual

npm i https://pkg.pr.new/@tanstack/angular-virtual@978
@tanstack/lit-virtual

npm i https://pkg.pr.new/@tanstack/lit-virtual@978
@tanstack/react-virtual

npm i https://pkg.pr.new/@tanstack/react-virtual@978
@tanstack/solid-virtual

npm i https://pkg.pr.new/@tanstack/solid-virtual@978
@tanstack/svelte-virtual

npm i https://pkg.pr.new/@tanstack/svelte-virtual@978
@tanstack/virtual-core

npm i https://pkg.pr.new/@tanstack/virtual-core@978
@tanstack/vue-virtual

npm i https://pkg.pr.new/@tanstack/vue-virtual@978

commit: abcda37

pkg-pr-new[bot] avatar Apr 06 '25 16:04 pkg-pr-new[bot]