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

Update start-here.md with gotchas on using x-for #4245

Closed

Conversation

james2doyle
Copy link

The start here page section on x-for doesn't mention the fact that you must have only one root element in a loop. I ran into this gotcha when trying to convert some Vue code to Alpine. It is only mentioned in a block quote on the x-for page itself.

I added an additional block of content on this and also an incorrect example with instructions on how to fix it

The start here page section on `x-for` doesn't mention the fact that you must have only one root element in a loop. I ran into this gotcha when trying to convert some Vue code to Alpine.

I added an additional block on this and also an incorrect example with instructions on how to fix it
@ekwoka
Copy link
Contributor

ekwoka commented May 30, 2024

This is covered on the x-for page, which is the appropriate place for it.

the get started can't have all the info about everything...

my opinion anyway.

@james2doyle
Copy link
Author

I hear you. This issue inhibited me from getting started so I thought it would be helpful to have on the getting started section.

I also noticed that if you use Alpine from npm there is no debug logging, so that got me too. But that is a different issue.

I went to the docs to read more and had to eventually see the one line on the x-for page

@ekwoka
Copy link
Contributor

ekwoka commented May 31, 2024

there is no debug logging

What do you mean?

I went to the docs to read more and had to eventually see the one line on the x-for page

I think making it larger in x-for would be reasonable. But it seems like the nuances of nested x-for/x-if makes more sense in their respective pages, as it's not a general "this is the basics of alpine".

@SimoTod
Copy link
Collaborator

SimoTod commented May 31, 2024

The debug logging is likely stripped out by whatever you use to bundle the script

@james2doyle
Copy link
Author

@ekwoka I was seeing this when using Alpine is jsfiddle:

Screen Shot 2024-05-30 at 10 43 23 AM

But when using Alpine in Vite through NPM, I wasn't getting the same logging info.

Back on topic, I see that the tone of the docs isn't really bad-to-good. So my contribution stands out a bit more than others

@ekwoka
Copy link
Contributor

ekwoka commented May 31, 2024

The code is the same for both. Your npm installed version may be just older than when the template root tag log was added.

But those logs do happen for sure.

And yeah, the docs could be improved some in many places. I'm just generally in favor of detailed info and gotchas focussed on the pages about that feature.

Getting started shouldn't be getting too in the weeds about these cases.

Maybe ensuring the sections in getting started also properly link to the relevant pages would be good.

@james2doyle
Copy link
Author

james2doyle commented May 31, 2024 via email

@SimoTod
Copy link
Collaborator

SimoTod commented May 31, 2024

@ekwoka I was seeing this when using Alpine is jsfiddle:

Screen Shot 2024-05-30 at 10 43 23 AM

But when using Alpine in Vite through NPM, I wasn't getting the same logging info.

Back on topic, I see that the tone of the docs isn't really bad-to-good. So my contribution stands out a bit more than others

As mentioned above, depending on your config, vite removes the console.log from the final bundled file.

But it's a fair point, people may not see those console log if they use the npm build with similar settings. Unfortunately there are a lot of things in the documentation and people should try to read the relevant sections, at least when they hit an unexpected behaviour.

You can imagine that if you start moving every note (you got stuck with that, other people may think another part deserves to be there, etc) to the 'start here' page, you'll end up with an endless page that it's too long to read and duplicates the rest of the docs.

That being said, Caleb is the maintainer. Just leave the pr open, he'll have a look and decide if it's worth adding it.

@calebporzio
Copy link
Collaborator

Agreed on all the above points. Thanks everyone for weighing in

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.

None yet

4 participants