SolidJSS
SolidJSโ€ข3y agoโ€ข
22 replies
Bersaelor

Make createMemo depend on unmentioned signal

I have a createMemo that depends on a list of objects

  const items = createMemo(() => props.articles.map((article) => article.id));


now, when I reorder that list of objects, the createMemo does not fire again, since I guess the content staid the same.

Now I defined
  const [reorderTag, setReorderTag] = createSignal(0);

that I increment each time I reorder the list.

Short of
  const items = createMemo(() => {
    console.log(`reorderTag: ${reorderTag}`);
    return props.articles.map((article) => article.id)
  });

how do I make sure it refires? Making logic depend on
console.log
feels dirty.
Was this page helpful?