Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
mbardelmeijer authored and github-actions[bot] committed Jul 6, 2023
1 parent 29aa0bd commit 6a25c7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
7 changes: 3 additions & 4 deletions src/LivewireNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Enflow\LivewireTwig;

use Livewire\LivewireBladeDirectives;
use Twig\Compiler;
use Twig\Node\Expression\AbstractExpression;
use Twig\Node\Node;
use Livewire\LivewireBladeDirectives;

class LivewireNode extends Node
{
Expand All @@ -24,7 +24,6 @@ public function compile(Compiler $compiler)
->write('$_vars = ')->subcompile($expr)->raw(";\n")
->write("?>\n")
->write(LivewireBladeDirectives::livewire("'$component', \$_vars"))
->write("<?php\n")
;
->write("<?php\n");
}
}
}
2 changes: 1 addition & 1 deletion src/LivewireTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

use Illuminate\Support\Str;
use Twig\Error\SyntaxError;
use Twig\Node\Expression\ArrayExpression;
use Twig\Token;
use Twig\TokenParser\AbstractTokenParser;
use Twig\Node\Expression\ArrayExpression;

class LivewireTokenParser extends AbstractTokenParser
{
Expand Down
13 changes: 9 additions & 4 deletions tests/NestedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ public function test_nested_component_renders_only_once()
class NestedChilds extends Component
{
public $elements;

public $counter = 0;

public function increment()
{
$this->counter++;
$this->counter++;
}

public function render()
{
return view('components.haschilds');
Expand All @@ -35,17 +37,20 @@ public function render()

class Child extends Component
{
static $renderedCount = 0;
public static $renderedCount = 0;

public $count = 1;

public function incrementChild()
{
$this->count++;
$this->count++;
}

public function render()
{
static::$renderedCount++;
$this->count = static::$renderedCount;

return view('components.counter');
}
}
}

0 comments on commit 6a25c7e

Please sign in to comment.