Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: couple refs to outer application DOM elements #409

Merged
merged 4 commits into from
Apr 12, 2024
Merged

Conversation

andy-haynes
Copy link
Contributor

This PR adds support for invoking DOM methods on outer application elements, supporting useRef cases such as:

import { useEffect, useRef } from 'react';

export default function() {
  const input = useRef(null);
  useEffect(() => {
    input.current.focus();
  }, []);

  return <input ref={input} type="text" />;
}

When refs are found on rendered Components (starting with the initial render), they are replaced with proxy objects that post messages to the outer application to invoke the DOM method on that node's corresponding outer application DOM element.

Copy link

vercel bot commented Apr 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bos-web-engine ❌ Failed (Inspect) Apr 12, 2024 6:38pm
bos-web-engine-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 12, 2024 6:38pm
bos-web-engine-sandbox ❌ Failed (Inspect) Apr 12, 2024 6:38pm

@andy-haynes
Copy link
Contributor Author

Failing tests/deployments are because I merged an unrelated issue fix with #410 to unblock the last commit

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.

2 participants