Skip to content

Error in 5.0.9 #157

Description

@autonome

Test case:

import { html, signal } from './uhtml.js';

const items = signal([]);

const ListItem = ({item}) =>
  html`<li>${item.text}</li>`;

const List = ({items}) =>
  html`<ul>
    ${items.value.map((item) =>
      html`<${ListItem} item=${item} />`
    )}
  </ul>`;

document.body.append(
  html`<${List} items=${items} />`
);

for (let i = 0; i < 3; i++) {
  items.value = [...items.value, ({text: `item ${i}`})];
}

The loop errors on the 3rd iteration:

Uncaught TypeError: can't access property "text", item is undefined

If I inline the li into List instead of a separate function, no error.

If I don't wrap the item in an object, and items is an array of strings, no error.

If I use the component fn directly instead of a nested tagged template, no error, eg:

${items.value.map(item => ListItem({item}))}

Activity

  1. WebReflection commented on Oct 2, 2025

    @WebReflection
    Owner

    I'm back from vacation (it's been a while) but had zero time to fix signals related things, as explained in the README:
    https://github.com/WebReflection/uhtml?tab=readme-ov-file#warning-%EF%B8%8F

    I don't have an ETA for when that will be fixed but what I can assure you is that any pattern that works now, will keep working once I do that ... and most patterns that don't work now, might be fixed but I don't know currently when.

  2. Kaleidosium commented on Oct 19, 2025

    @Kaleidosium

    I don't have an ETA for when that will be fixed but what I can assure you is that any pattern that works now, will keep working once I do that ... and most patterns that don't work now, might be fixed but I don't know currently when.

    FYI, I'm interested in using uhtml v5 for a website I'm planning on making for a friend, if possible, can the bugs and other oddities be fixed before the new year? Thanks.

  3. WebReflection commented on Oct 19, 2025

    @WebReflection
    Owner

    I hope so

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions