Skip to content

Commit e0eb437

Browse files
committed
better delete example
1 parent 7a01b60 commit e0eb437

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/blog/tanstack-start-ssr-performance-600-percent.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ See: [#4648](https://github.com/TanStack/router/pull/4648), [#6505](https://gith
229229

230230
### The mechanism
231231

232-
Modern engines optimize property access using object "shapes" (e.g. V8 HiddenClasses / JSC Structures) and inline caches. `delete` changes an object's shape and can force a slower internal representation (e.g. dictionary/slow properties), which can disable or degrade those optimizations and deopt optimized code.[^v8-fast-properties][^webkit-delete-ic]
232+
Modern engines optimize property access using object "shapes" (e.g. V8 HiddenClasses[^v8-fast-properties] / JSC Structures[^webkit-delete-ic]) and inline caches. `delete` changes an object's shape and can force a slower internal representation (e.g. dictionary/slow properties), which can disable or degrade those optimizations and deopt optimized code.
233233

234234
### The transferable pattern
235235

@@ -242,12 +242,10 @@ Avoid `delete` in hot paths. Prefer patterns that don't mutate object shapes in-
242242

243243
```typescript
244244
// Before: mutates shape
245-
delete linkProps.activeProps
246-
delete linkProps.inactiveProps
245+
delete this.shouldViewTransition
247246

248-
// After: create new object without keys
249-
const { activeProps, inactiveProps, ...rest } = linkProps
250-
return rest
247+
// After: set to undefined
248+
this.shouldViewTransition = undefined
251249
```
252250

253251
See: [#6456](https://github.com/TanStack/router/pull/6456), [#6515](https://github.com/TanStack/router/pull/6515)

0 commit comments

Comments
 (0)