Skip to content

fix(design-system): preserve iframe shield across concurrent resizers - #533

Merged
tornado-softwares merged 2 commits into
aymericzip:mainfrom
yangguan-xue:fix/iframe-shield-concurrent-instances
Nov 2, 2026
Merged

tornado-softwares merged 2 commits into
aymericzip:mainfrom
yangguan-xue:fix/iframe-shield-concurrent-instances

Conversation

@yangguan-xue

Copy link
Copy Markdown
Contributor

Follow-up to #531, addressing the duplicate disable and concurrent instance review comments.

Repeated disables on the same hook instance are ignored. Different instances share a WeakMap reference count, so each iframe's original pointer-events value is restored only when the last instance releases its claim.

Adds 10 regression tests covering duplicate calls, both release orders, re-acquisition, unmount cleanup and detached iframes.

Validation: design-system build and typecheck passed; 49 test files passed (357 tests passed, 1 skipped); Biome passed for both changed files.

…lict in iframe pointer shield

Keep a module-level WeakMap with a reference count of holding instances
per iframe. Each hook instance acquires the shield claim at most once,
so repeated disable calls are no-ops; on restore, each captured iframe's
reference count is decremented and its original inline pointer-events is
restored only when the count drops to zero.

Cover edge cases with regression tests: duplicate disable/restore calls,
concurrent instances with out-of-order and unmount releases, re-acquiring
while another instance still holds, distinct initial inline values, and
iframe DOM detachment during interactions.
- [Configuration](https://intlayer.org/doc/concept/configuration.md)

### Packages

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Nice for AGI :D

/**
* Module-level registry tracking iframes shielded by active drag interactions.
*
* WeakMap ensures that if an iframe element is garbage collected, its entry

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hmm okay

@tornado-softwares tornado-softwares left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Sounds good to me! Good to merge, @aymericzip

@tornado-softwares

Copy link
Copy Markdown
Collaborator

Thanks for taking the time to fix the issue I mentioned, even after your previous PR had already been merged. And thanks more generally for your contribution @yangguan-xue !!

@tornado-softwares
tornado-softwares merged commit 9a6c65c into aymericzip:main Nov 2, 2026
1 of 2 checks passed
@aymericzip

Copy link
Copy Markdown
Owner

Hey @yangguan-xue @tornado-softwares

I confirm that the changes fixed the issue, thanks both!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants