Skip to content

Commit

Permalink
Better comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bencroker committed Aug 21, 2024
1 parent 8c06ddd commit bd2ef6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/services/ComponentsService.php
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function create(string $value, array $variables = [], array|string $attri
$mergedVariables = $event->variables;
$attributes = $event->attributes;

// Allow ID to be overridden, otherwise ensure random ID does not start with a digit (to avoid a JS error)
// Fall back to a random ID that does not start with a digit (to avoid a JS error)
$id = $attributes['id'] ?? ('component-' . StringHelper::randomString(6));
$values['sprig:id'] = Craft::$app->getSecurity()->hashData($id);

Expand Down

0 comments on commit bd2ef6b

Please sign in to comment.