Skip to content

New root component doesn't work with Map #13056

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

Closed
JonathonRP opened this issue Aug 28, 2024 · 4 comments
Closed

New root component doesn't work with Map #13056

JonathonRP opened this issue Aug 28, 2024 · 4 comments

Comments

@JonathonRP
Copy link

Describe the bug

image
root component doesn't allow using map, works with object and key but Map is more performant for lookups.

Reproduction

make a map that can return a svelte component
then call with new dynamic element
<map.get(key) />

Logs

No response

System Info

svelte 5

Severity

annoyance

@MotionlessTrain
Copy link
Contributor

Only variable names and object properties are allowed there, not all expressions

You can instead do

{@const Widget = widgets.get(widget)}
<Widget />

Or define Widget within the script tag, if both widgets and widget are available there

@JonathonRP
Copy link
Author

yeah currently doing that for workaround, is there a design reason for not allowing maps, do you know?

@MotionlessTrain
Copy link
Contributor

They needed to draw a line somewhere:
#12821 (comment)

@Conduitry Conduitry closed this as not planned Won't fix, can't repro, duplicate, stale Aug 28, 2024
@JonathonRP
Copy link
Author

yeah, that stinks. I would have said the line should be after maps, they are common but yeah not much to do.

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

No branches or pull requests

3 participants