question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UI to surface Alpine.js eval errors

See original GitHub issue

Alpine.js uses console.warn in the following scenarios:

  1. ~~x-if/x-for on a non-template https://github.com/alpinejs/alpine/blob/ee019cbc66d2adb3e5126bf3822d9d701a40daf8/src/utils.js#L29~~ #141
  2. ~~template with more than 1 child node https://github.com/alpinejs/alpine/blob/ee019cbc66d2adb3e5126bf3822d9d701a40daf8/src/utils.js#L31~~ #141
  3. error during expression evaluation https://github.com/alpinejs/alpine/blob/5cc46c31b08e4b25821fb85fd0fad6903bc7e574/src/utils.js#L69

I believe some developers suppress console.warn, it would be nice to surface the relevant errors/warnings:

  • in a “warnings” tab in the devtools
  • highlight the offending components/elements (toggleable through settings)

For 1. and 2. we should probably re-scan the DOM and to figure out which are the offending template’s. Moved to a separate issue to have additional structural checks #141

For 3. the console.warn contains the element as well as the expression.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:28 (13 by maintainers)

github_iconTop GitHub Comments

3reactions
stephenoldhamcommented, Dec 17, 2020

I think in terms of the content hierarchy I prefer the footer. Also feels like there’s more space in that layout with less at the top.

@HugoDF As you said we can totally change it if we don’t vibe that layout in practise.

2reactions
ryangjchandlercommented, Dec 17, 2020

The 2nd one in is my favourite. The separator is nice, but I also like the last one with the different BG colour.

Read more comments on GitHub >

github_iconTop Results From Across the Web

CSP
Under the hood, Alpine doesn't actually use eval() itself because it's slow and problematic. Instead it uses Function declarations, which are much better, ......
Read more >
How to pass refs to a component in alpine js 3?
Then, I get to know that functions called init are auto invoked in Alpine v3 (https://alpinejs.dev/directives/init#auto-evaluate-init-method).
Read more >
Django, HTMX and Alpine.js: Modern websites, JavaScript ...
Most server-side libraries make it equally easy to surface validation errors for those questions as they do questions like "Is this Password no ......
Read more >
the Alpine crust-mantle boundary | Geophysical Journal ...
Each sub-interface depicts the smoothest possible (i.e. simplest) surface, fitting the reflector data within their assigned errors.
Read more >
Evaluation of an ERTS-1 Data Collection Platform Installed ...
surface layer. J. Appl. Meteor., 9, 857-861. Evaluation of an ERTS-1 Data Collection Platform Installed in the Alpine Tundra, Colorado.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found