Skip to content

Conversation

@maciek50322
Copy link
Contributor

I found that the "signal created when used" is giving wrong values when it's read only later after changes (eg. only in event callback function and none in jsx or other signals or component creation - work correctly if it's used there).

@changeset-bot
Copy link

changeset-bot bot commented May 29, 2025

🦋 Changeset detected

Latest commit: 2f06d07

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@solid-primitives/list Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@thetarnav
Copy link
Member

Please remove changes to the changelog and package json, these are updated automatically by the ci workflow.
Also could you add tests showing when the values were wrong?
mapArray and keyArray are using mapFn.length to check if the index signal is used or not. It would make sense to be consistent with a mapArray alternative.

@maciek50322
Copy link
Contributor Author

Done.

mapArray and keyArray are using mapFn.length to check if the index signal is used or not.

But for that I argue that you can use arguments that are over what mapFn.length gives...

function mapFn(...args) {
    const value = args[0];
    const index = args[1];
    console.log(`value = ${value}, index = ${index}`);
}

console.log(mapFn.length); // logs: 0
mapFn(1, 2);               // logs: value = 1, index = 2

Probably uncommon but still

@maciek50322
Copy link
Contributor Author

Ok so I found different way to fix this issue - when creating signal get fresh item index & value instead of one that it was created with. After this change new test passes

@thetarnav thetarnav merged commit a67c0e3 into solidjs-community:main May 30, 2025
2 checks passed
@github-actions github-actions bot mentioned this pull request May 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants