Skip to content

Commit

Permalink
Merge pull request #3 from wayfair/fallback_uuid
Browse files Browse the repository at this point in the history
include uuid as id in fallback html
  • Loading branch information
roippi authored Jan 20, 2017
2 parents 99bb725 + 8dca14f commit f7a8684
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 4 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"type": "library",
"require": {
"php": ">=5.6.0",
"guzzlehttp/guzzle": "^6.2"
"guzzlehttp/guzzle": "^6.2",
"ramsey/uuid": "^3.5"
},
"require-dev": {
"phpunit/phpunit": "^5.7"
Expand Down
132 changes: 131 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions src/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,10 +214,12 @@ protected function fallback($topLevelError, $jobs)
*/
protected function getFallbackHTML($moduleName, $data)
{
$uuid = \Ramsey\Uuid\Uuid::uuid4();
return sprintf(
'<div data-hypernova-key="%1$s"></div>
<script type="application/json" data-hypernova-key="%1$s"><!--%2$s--></script>',
'<div data-hypernova-key="%1$s" data-hypernova-id="%2$s"></div>
<script type="application/json" data-hypernova-key="%1$s" data-hypernova-id="%2$s"><!--%3$s--></script>',
$moduleName,
$uuid,
json_encode($data)
);
}
Expand Down

0 comments on commit f7a8684

Please sign in to comment.