feat: support auto-generated _k keys in range item matching#18
Conversation
Check for the auto-generated _k field first in getItemKey() to support range items that don't have explicit key attributes in the template. This works in conjunction with the server-side change that injects _k fields into range items when no explicit key attribute is defined. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
LGTM! Clean implementation of the auto-generated key support. The priority order makes sense: No issues found:
Approved ✓ |
There was a problem hiding this comment.
Pull request overview
This PR adds client-side support for auto-generated _k keys in range item matching, complementing the server-side auto-key injection feature from livetemplate/livetemplate#108. When templates don't define explicit key attributes, the server now injects content-based hashes into each item's _k field, and this change ensures the client checks that field first for proper item identification in range operations.
Changes:
- Modified
getItemKey()to prioritize the auto-generated_kfield over explicit key attributes fromrangeIdKeys
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
_kfield first ingetItemKey()to support range items without explicit key attributesContext
This is the client-side counterpart to livetemplate/livetemplate#108.
When templates don't define explicit key attributes (like
data-key="{{.ID}}"), the server now injects a content-based hash into each item's_kfield. This change ensures the client checks_kfirst, allowing proper key matching.Test plan
🤖 Generated with Claude Code