Skip to content

Conversation

@Smrtnyk
Copy link
Contributor

@Smrtnyk Smrtnyk commented Jun 18, 2025

fixes #10659

@codesandbox
Copy link

codesandbox bot commented Jun 18, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@Smrtnyk Smrtnyk closed this Jun 18, 2025
@Smrtnyk Smrtnyk reopened this Jun 18, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 18, 2025

Build Stats

file / KB (diff) bundled minified
fabric 918.154 (+0.295) 302.264 (+0.098)

@Smrtnyk
Copy link
Contributor Author

Smrtnyk commented Jun 18, 2025

the unit test I added hangs on vitest without the fix

if (gradientDef) {
const opacityAttr = el.getAttribute(property + '-opacity');
const gradient = Gradient.fromElement(gradientDef, obj, {
const gradient = Gradient.fromElement(gradientDef.def, obj, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we are using gradientDef.def, the if condition above needs to check for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch will add few more unit tests

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed new commit, please recheck

 fix condition and add 2 more unit tests
@asturur
Copy link
Member

asturur commented Jun 18, 2025

I m not sure how this fix works.
We need more svg examples to be sure this is a fix.
i didn't check why it was recursively looping on itself.
If it was for the clippath.clippath reason, i do not think this fix can work for real use case scenario outside this simeple one. We need to build a better use case to test and be sure legit use cases are rendered correctly.

I didn't dig in the code when i checked this issue, but my impression was that i would have had to duplicate the double referenced clipPath with a clone of itself in order to avoid the infinite recursion

@Smrtnyk
Copy link
Contributor Author

Smrtnyk commented Jun 18, 2025

I m not sure how this fix works. We need more svg examples to be sure this is a fix. i didn't check why it was recursively looping on itself. If it was for the clippath.clippath reason, i do not think this fix can work for real use case scenario outside this simeple one. We need to build a better use case to test and be sure legit use cases are rendered correctly.

I didn't dig in the code when i checked this issue, but my impression was that i would have had to duplicate the double referenced clipPath with a clone of itself in order to avoid the infinite recursion

you are right
I might be just plastering over a bigger issue
lets close for now and I can come back to it when I have more time, if it doesn't get fixed in the mean time

@Smrtnyk Smrtnyk closed this Jun 18, 2025
@Smrtnyk Smrtnyk deleted the fix()-fix-infinite-recursion-with-nested-duplicate-clip-paths branch June 18, 2025 12:52
@asturur
Copy link
Member

asturur commented Jun 18, 2025

Leave it open, the hardest task is to make an svg that has a nested clipPath and that has visual differences with one that doesn't have a nested clipPath. Once we have a reproducible use case of an svg that can render something that works we can add it here and see what happens

@Smrtnyk Smrtnyk restored the fix()-fix-infinite-recursion-with-nested-duplicate-clip-paths branch June 18, 2025 13:45
@Smrtnyk Smrtnyk reopened this Jun 18, 2025
@Smrtnyk
Copy link
Contributor Author

Smrtnyk commented Jun 18, 2025

Leave it open, the hardest task is to make an svg that has a nested clipPath and that has visual differences with one that doesn't have a nested clipPath. Once we have a reproducible use case of an svg that can render something that works we can add it here and see what happens

I have reopened it now
will see if I can find some svgs that do something useful for these scenarios
or if someone else has them can plop them in here

@stale
Copy link

stale bot commented Jul 19, 2025

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs 😔. Thank you for your contributions.

@stale stale bot added the stale Issue marked as stale by the stale bot label Jul 19, 2025
@Smrtnyk
Copy link
Contributor Author

Smrtnyk commented Oct 8, 2025

closing in favor of #10774

@Smrtnyk Smrtnyk closed this Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Issue marked as stale by the stale bot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: nested duplicated clipPath causes infinite recursion

2 participants