@@ -14,12 +14,13 @@ public static function compile($expression = ''): string
14
14
$ id = trim (trim ($ expression ), "\' \"" ) ?: 'app ' ;
15
15
16
16
$ template = '<?php
17
- if (!isset($__inertiaSsr)) {
18
- $__inertiaSsr = app(\Inertia\Ssr\Gateway::class)->dispatch($page);
17
+ if (!isset($__inertiaSsrDispatched)) {
18
+ $__inertiaSsrDispatched = true;
19
+ $__inertiaSsrResponse = app(\Inertia\Ssr\Gateway::class)->dispatch($page);
19
20
}
20
21
21
- if ($__inertiaSsr instanceof \Inertia\Ssr\Response ) {
22
- echo $__inertiaSsr ->body;
22
+ if ($__inertiaSsrResponse ) {
23
+ echo $__inertiaSsrResponse ->body;
23
24
} else {
24
25
?><div id=" ' .$ id .'" data-page="{{ json_encode($page) }}"></div><?php
25
26
}
@@ -36,12 +37,13 @@ public static function compile($expression = ''): string
36
37
public static function compileHead ($ expression = '' ): string
37
38
{
38
39
$ template = '<?php
39
- if (!isset($__inertiaSsr)) {
40
- $__inertiaSsr = app(\Inertia\Ssr\Gateway::class)->dispatch($page);
40
+ if (!isset($__inertiaSsrDispatched)) {
41
+ $__inertiaSsrDispatched = true;
42
+ $__inertiaSsrResponse = app(\Inertia\Ssr\Gateway::class)->dispatch($page);
41
43
}
42
44
43
- if ($__inertiaSsr instanceof \Inertia\Ssr\Response ) {
44
- echo $__inertiaSsr ->head;
45
+ if ($__inertiaSsrResponse ) {
46
+ echo $__inertiaSsrResponse ->head;
45
47
}
46
48
?> ' ;
47
49
0 commit comments