Skip to content

Commit 7fc0832

Browse files
authored
fix: Remove direct Props spread from Image tag (#26)
# Description Removes `props` from being spread on `Image` component. This shoudln't be necessary as the relevant props are applied via: https://github.com/cloudinary-community/svelte-cloudinary/blob/main/svelte-cloudinary/src/lib/components/CldImage.svelte#L56 This is to avoid any non-native props to be added to the DOM ## Issue Ticket Number Fixes #25 <!-- Specify above which issue this fixes by referencing the issue number (`#<ISSUE_NUMBER>`) or issue URL. --> <!-- Example: Fixes https://github.com/cloudinary-community/svelte-cloudinary/issues/<ISSUE_NUMBER> --> ## Type of change <!-- Please select all options that are applicable. --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] Fix or improve the documentation - [ ] This change requires a documentation update # Checklist <!-- These must all be followed and checked. --> - [ ] I have followed the contributing guidelines of this project as mentioned in [CONTRIBUTING.md](/CONTRIBUTING.md) - [ ] I have created an [issue](https://github.com/cloudinary-community/svelte-cloudinary/issues) ticket for this PR - [ ] I have checked to ensure there aren't other open [Pull Requests](https://github.com/cloudinary-community/svelte-cloudinary/pulls) for the same update/change? - [ ] I have performed a self-review of my own code - [ ] I have run tests locally to ensure they all pass - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes needed to the documentation
1 parent 9e5ad74 commit 7fc0832

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

svelte-cloudinary/src/lib/components/CldImage.svelte

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
CLD_OPTIONS.push(prop);
2727
});
2828
});
29+
2930
const imageProps = {
3031
alt,
3132
src,
@@ -39,7 +40,9 @@
3940
.forEach((key) => (imageProps[key] = $$props[key]));
4041
4142
// Construct Cloudinary-specific props by looking for values for any of the supported prop keys
43+
4244
const cldOptions = {};
45+
4346
CLD_OPTIONS.forEach((key) => {
4447
if ($$props[key]) {
4548
// @ts-expect-error cldOptions doesn't know the types of the keys
@@ -62,14 +65,9 @@
6265
console.warn(`Failed to preserve transformations: ${(e as Error).message}`);
6366
}
6467
}
65-
const url = getCldImageUrl({
66-
...imageProps,
67-
...cldOptions,
68-
})
6968
</script>
7069

7170
<Image
72-
{...$$props}
7371
{...imageProps}
7472
cdn="cloudinary"
7573
transformer={({ width, url, height}) => {

0 commit comments

Comments
 (0)