-
Notifications
You must be signed in to change notification settings - Fork 17
Description
Package
storyblok-js-client (Client SDK)
Bug Description
When using the storyblok-js-client SDK and setting the option inlineAssets to true, all information of the current image is overridden. This is problematic, when for instance the alt text is different on the image, that is used in the story.
If you look into the implementation, you see, that the whole image object is replaced with the master asset object, which might have different fields, then the image, that is used in the story.
Steps to Reproduce
- create a Story in Storyblok that has an image included
- select an image from the Asset Library
- override the alt text of the image in the story
- request the story using the
storyblok-js-clientwithinlineAssets: true. - See the alt text from the master image instead of the change alt text
Expected Behavior
when inlining assets, only properties, that are not present on the image attached to the story should be merged. For instance, the is_private property is not present on the attached image. Asset fields like the alt text or the caption should not be overridden.
Actual Behavior
Currently, due to the complete override of the image, all information that is changed on the attached image will be overridden from the master image which leads to not translated alt text or captions.
Code Sample
// how it is currently done in your code
if (processedNode.fieldtype === 'asset' && Array.isArray(response.data.assets)) {
// Replace the assets array with the actual asset objects
processedNode = {
...processedNode,
// this will completely override all root level fields of the attached asset.
...response.data.assets.find((asset: any) => asset.id === processedNode.id),
};
}Environment
System:
OS: macOS 26.0
CPU: (14) arm64 Apple M4 Pro
Memory: 1.12 GB / 48.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.19.0 - ~/.nvm/versions/node/v22.19.0/bin/node
npm: 10.9.3 - ~/.nvm/versions/node/v22.19.0/bin/npm
pnpm: 10.16.1 - ~/Library/pnpm/pnpm
Browsers:
Chrome: 140.0.7339.186
Edge: 140.0.3485.81
Safari: 26.0
npmPackages:
@storyblok/astro: ^7.2.5 => 7.3.0
@storyblok/richtext: ^3.7.0 => 3.8.0
storyblok: ^4.4.1 => 4.6.2
vue: ^3.5.21 => 3.5.21Error Logs
Additional Context
No response