<h3 dir="auto">Vue.js version</h3>
<p dir="auto">1.0.20</p>
<h3 dir="auto">Reproduction Link</h3>
<p dir="auto"><a href="https://jsfiddle.net/ardoramor/hyk86ca3/" rel="nofollow">https://jsfiddle.net/ardoramor/hyk86ca3/</a></p>
<h3 dir="auto">Steps to reproduce</h3>
<p dir="auto">Run fiddle, examine console.</p>
<h3 dir="auto">What is Expected?</h3>
<p dir="auto">Entries will be tracked by the specified path, just like in filters (e.g., <code class="notranslate">orderBy</code>)</p>
<h3 dir="auto">What is actually happening?</h3>
<p dir="auto">VueJs prints out a warning and fails to get the unique value specified by path</p>
<h3 dir="auto">Required change</h3>
<p dir="auto">There are three lines that would need to change from <code class="notranslate">value[trackByKey]</code> to <code class="notranslate">getPath(value, trackByKey)</code> in functions <code class="notranslate">cacheFrag</code>, <code class="notranslate">getCachedFrag</code>, and <code class="notranslate">deleteCachedFrag</code>. I can make a PR but maybe such a small change doesn't require it?</p>
<p dir="auto">Also, is it possible to add expression evaluation for <code class="notranslate">track-by</code>? This way, a combination of fields can yield a unique identifier (e.g., <code class="notranslate">track-by="employee.company + employee.id"</code>, in case <code class="notranslate">id</code> can be reused by companies). I have a different application but this should make sense as well.</p>
<h3 dir="auto">What problem does this feature solve?</h3>
<p dir="auto">Keep-alive filter by slot instance.</p>
<p dir="auto">I need to use it to filter my route component in <code class="notranslate">router-view</code> by <code class="notranslate">:key="$route.fullPath"</code></p>
<h3 dir="auto">What does the proposed API look like?</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;keep-alive :include-keys=&quot;function(keyOfSlot:string) or regex or string&quot;&gt;
  &lt;component :key=&quot;myKey&quot;/&gt;
&lt;/keep-alive&gt;"><pre class="notranslate"><code class="notranslate">&lt;keep-alive :include-keys="function(keyOfSlot:string) or regex or string"&gt;
  &lt;component :key="myKey"/&gt;
&lt;/keep-alive&gt;
</code></pre></div>