Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MapEntries control flow component. #728

Merged
merged 13 commits into from
Jan 5, 2025

Conversation

AlexErrant
Copy link
Contributor

@AlexErrant AlexErrant commented Jan 1, 2025

This PR adds <MapEntries>, which is a small iteration on <Entries>. A character-level diff may be useful when reviewing this PR, as most of my changes were copy/paste/modify. E.g. https://www.diffchecker.com/zRdYuasY/ (note the "Highlight change", "Character" option on the left side. (That link expires in a month - there is no permanent option.))

I also add a demo for <Entries>, <MapEntries>, and ReactiveMap working with <MapEntries>, which accounts for most of the linecount. Here's a video of the <MapEntries> demo showing how it's fine-grained.

chrome_F9oHokxTNJ.mp4

If this gets accepted I'll also contribute <SetEntries> in a followup.

Copy link

changeset-bot bot commented Jan 1, 2025

🦋 Changeset detected

Latest commit: 533c821

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

This PR includes changesets to release 2 packages
Name Type
@solid-primitives/keyed Minor
@solid-primitives/immutable 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

thetarnav commented Jan 2, 2025

All good but this should be added to the map package directly.

README.md Outdated Show resolved Hide resolved
@thetarnav
Copy link
Member

thetarnav commented Jan 2, 2025

Ok
my bad with the initial suggestion, I haven't looked too deeply at the changes and assumed that MapEntries directly depends on the map package
I think that MapEntries should be added to keyed package like it was at the beginning (you can just revert I guess)
The demo shows both the usage with Map and ReactiveMap which is great
But the docs should mention it as well, explain when you'd use one or another, how does that impact rendering
Also some basic tests are missing
It would be useful to ensure that the interaction between Map, ReactiveMap and MapEntries is covered by the tests and doesn't change.

@thetarnav
Copy link
Member

thetarnav commented Jan 2, 2025

MapEntries doesn't have any special interaction with ReactiveMap, right?
The demo works the same way for both.
If there is no difference then it might be pointless to even include ReactiveMap there nor add any special tests.

@thetarnav
Copy link
Member

this month passed fast

image

@AlexErrant
Copy link
Contributor Author

I think that MapEntries should be added to keyed package like it was at the beginning

Some food for bikeshedding (I really do not care, just bringing it up cuz why not), as of 9ebe450 , <Entries> no longer uses keyArray. Nor does <MapEntries>, so one could argue that they don't belong in keyed. Maybe Entries, MapEntries, and SetEntries should be their own package/primitive? Or part of List?

this month passed fast

Ah, I probably pasted the wrong link; updated the post >_>

@thetarnav
Copy link
Member

Let's stick with keyed right now.
Can be moved to a different package if needed later.

packages/keyed/README.md Show resolved Hide resolved
packages/keyed/README.md Outdated Show resolved Hide resolved
packages/keyed/dev/entries.tsx Show resolved Hide resolved
packages/keyed/dev/entries.tsx Outdated Show resolved Hide resolved
packages/keyed/dev/mapEntries.tsx Show resolved Hide resolved
better docs

Co-authored-by: Damian Tarnawski <gthetarnav@gmail.com>
@thetarnav thetarnav merged commit 6026ab2 into solidjs-community:main Jan 5, 2025
3 checks passed
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