-
-
Notifications
You must be signed in to change notification settings - Fork 341
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
[Site] More Functional Code, 2x Complex Live Components Examples, few fixes #804
Conversation
if (!($e instanceof \Exception)) { | ||
$e = new \Exception($e->getMessage(), $e->getCode(), $e->getPrevious()); | ||
} | ||
throw new RuntimeError(sprintf('Error rendering "%s" component: %s', $name, $e->getMessage()), previous: $e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I snuck this feature in. We may need some trial and error. But throwing a RuntimeError
allows Twig to show the actual template + line number where the error occurred. The nested exception will be the one from your component (e.g. maybe you are passing null
to a property in your component that only accepts string
).
@@ -75,7 +77,7 @@ public function preLexComponents(string $input): string | |||
$lastComponentName = $lastComponent['name']; | |||
|
|||
if ($closingComponentName !== $lastComponentName) { | |||
throw new \RuntimeException("Expected closing tag '</twig:{$lastComponentName}>' but found '</twig:{$closingComponentName}>' at line {$this->line}"); | |||
throw new SyntaxError("Expected closing tag '</twig:{$lastComponentName}>' but found '</twig:{$closingComponentName}>'", $this->line); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a correction: allows the lexing error to show the template + line number in the exception.
Maybe indicate somehow that it is clickable? (more descriptive text, icon...) |
e325bfb
to
39aeb14
Compare
Done! We can iterate on it if it's still not obvious |
And various other site updates. Also improving Twig errors.
39aeb14
to
e6edbde
Compare
Hi!
Prepping ux.symfony.com for 2.8 - very excited about this! Join me on a tour:
1) Invoice Creator Live Component Demo
invoice-creator.mp4
Parent component + collection of child components communicating by emitting events!
2) Product form + modal to create a Category
product-form.mp4
Opens a Bootstrap modal with a child component inside - and closes that modal from a
LiveAction
.3) Much nicer code blocks
Before:
After:
4) Explanations on longer examples
Some examples deserve pointing out a few of the more complex parts. Some of the live component demos now do this:
5) Using a LOT of new features
Smart rendering, emitting events, browser events, etc, etc - MANY new features are being used on the site now.
We're also using (in som
e places) the new
<twig:Component>
syntax from #771. Even though editor support (e.g. for auto-completion) doesn't exist yet, I LOVE this. For example, to render a code block:Thanks everyone for the work, review & testing on a lot of this new stuff. Using the new features on the site has been BLAST.