Problem/Motivation
Facing issues only with Sotrybook after updates for :
- Drupal 10.2.0
- cl_server 2.0.0-beta5
- @lullabot/storybook-drupal-addon 2.0.6
Response body: The website encountered an unexpected error. Try again later.<br><br><em class="placeholder">Twig\Error\RuntimeError</em>: The merge filter only works with arrays or "Traversable", got "string" for argument 2. in <em class="placeholder">twig_array_merge()</em>
the use of array_merge in Drupal is changing!!
Drupal 10 is using "twig/twig": "^3.5.0",
twig/twig 3.8.0 is out and in use for now
But 3.9.0 will be out and it will have deprecations.
https://github.com/twigphp/Twig/blob/v3.5.1/src/Extension/CoreExtension....
/**
* Merges an array with another one.
*
* {% set items = { 'apple': 'fruit', 'orange': 'fruit' } %}
*
* {% set items = items|merge({ 'peugeot': 'car' }) %}
*
* {# items now contains { 'apple': 'fruit', 'orange': 'fruit', 'peugeot': 'car' } #}
*
* @param array|\Traversable $arr1 An array
* @param array|\Traversable $arr2 An array
*
* @return array The merged array
*/
function twig_array_merge($arr1, $arr2)
{
if (!twig_test_iterable($arr1)) {
throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as first argument.', \gettype($arr1)));
}
if (!twig_test_iterable($arr2)) {
throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" as second argument.', \gettype($arr2)));
}
return array_merge(twig_to_array($arr1), twig_to_array($arr2));
}
Storybook + CL Server having issues passing values and doing twig merge array
Move functions for CoreExtension
fabpot committed 3 weeks ago
https://github.com/twigphp/Twig/blob/v3.8.0/src/Extension/CoreExtension....
function twig_array_merge(...$arrays)
{
$result = [];
foreach ($arrays as $argNumber => $array) {
if (!is_iterable($array)) {
throw new RuntimeError(sprintf('The merge filter only works with arrays or "Traversable", got "%s" for argument %d.', \gettype($array), $argNumber + 1));
}
$result = array_merge($result, twig_to_array($array));
}
return $result;
}
Proposed resolution
- Add Storybook's controls for all Utility Classes and Attributes : for all Stories
- Remove passing of empty array or empty objects from the Storybook story to to SDC by CL Server
Remaining tasks
- ✅ File an issue about this project
- ✅ Addition/Change/Update/Fix to this project
- ✅ Testing to ensure no regression
- ➖ Automated unit/functional testing coverage
- ➖ Developer Documentation support on feature change/addition
- ➖ User Guide Documentation support on feature change/addition
- ➖ UX/UI designer responsibilities
- ✅ Accessibility and Readability
- ✅ Code review from 1 Varbase core team member
- ✅ Full testing and approval
- ✅ Credit contributors
- ✅ Review with the product owner
- ✅ Update Release Notes and Update Helper on new feature change/addition
- ✅ Release varbase-10.0.0-rc2, varbase_components-2.0.0-alpha30
- ✅ No Update
- ➖ Optional Update
- ➖ Forced Update
- ➖ Forced Update if Unchanged
User interface changes
API changes
Data model changes
Release notes snippet
- Issue #3412132: Fixed Storybook issues with Drupal
10.2.0 after cl_server 2.0.0-beta5 and @lullabot/storybook-drupal-addon 2.0.6
Comments
Comment #2
rajab natshahComment #4
rajab natshahComment #5
rajab natshahComment #6
rajab natshah✅ Released varbase_components-2.0.0-alpha30
Comment #7
rajab natshahComment #9
rajab natshahComment #10
rajab natshah✅ Released varbase-10.0.0-rc2