You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ThemeFileSystem.files have an attachment, or a value
Currently, we save '' instead of undefined. For example, images would have: {attachment: '<base64_string>, value: ''}
We should either update the type signature to reflect this, or update the default value to set undefined
Suggestions
We can consider consistency with the API or simplicity of CLI code when making this decision.
Personally, I think modelling how the API views this is a good first pass approach. We should set the empty value to undefined and verify any fallback logic of || or ?? doesn't break. (This could break if we are expecting the '' value in the LHS of || to be considered truthy.
This should stay `||` imo. This will reflect the behaviour in [theme-fs](https://github.com/Shopify/cli/blob/55307bb53694f67022862d84de5f5e85744feec7/packages/theme/src/cli/utilities/theme-fs.ts#L60-L75), which saves `''` instead of `undefined`
Now that I think about it, we could probably consider changing that across the codebase (should be done separately if so)
ThemeFileSystem.files have an
attachment
, or avalue
Currently, we save
''
instead of undefined. For example, images would have:{attachment: '<base64_string>, value: ''}
We should either update the type signature to reflect this, or update the default value to set
undefined
Suggestions
undefined
and verify any fallback logic of||
or??
doesn't break. (This could break if we are expecting the''
value in the LHS of||
to be considered truthy.Now that I think about it, we could probably consider changing that across the codebase (should be done separately if so)
Originally posted by @jamesmengo in #4732 (comment)
The text was updated successfully, but these errors were encountered: