Skip to content

Releases: Shopify/remote-dom

@remote-dom/core@1.11.0

01 May 13:21
3665d97

Choose a tag to compare

Minor Changes

  • #604 7177edb Thanks @justinhenricks! - Flush BatchingRemoteConnection mutations on a microtask by default

    The default batch function used by BatchingRemoteConnection now schedules flushes on a microtask (via queueMicrotask, falling back to Promise.resolve().then(...)) instead of a macrotask via MessageChannel/setTimeout.

    This ensures that DOM mutations made in the remote environment are delivered to the host before any awaited RPC response resolves, avoiding a class of bugs where the host sees an RPC result before the element updates that produced it (for example, a perform() callback setting an error on a field, only to have the host run its post-await logic before that error mutation arrives).

    If you were relying on the previous macrotask behavior, you can restore it by passing a custom batch option, e.g.:

    new BatchingRemoteConnection(connection, {
      batch: (flush) => {
        const channel = new MessageChannel();
        channel.port1.onmessage = () => flush();
        channel.port2.postMessage(null);
      },
    });

@remote-dom/polyfill@1.5.1

10 Oct 14:31
c4e950b

Choose a tag to compare

Patch Changes

@remote-dom/core@1.10.1

10 Oct 14:31
c4e950b

Choose a tag to compare

Patch Changes

@remote-dom/core@1.10.0

06 Oct 16:00
877d99e

Choose a tag to compare

Minor Changes

@remote-dom/polyfill@1.5.0

29 Aug 14:52
834c9d2

Choose a tag to compare

Minor Changes

@remote-dom/polyfill@1.4.7

29 Aug 13:50
aa00798

Choose a tag to compare

Patch Changes

@remote-dom/polyfill@1.4.6

25 Aug 09:30
85e0e45

Choose a tag to compare

Patch Changes

@remote-dom/core@1.9.0

04 Jul 19:03
e16a89c

Choose a tag to compare

Minor Changes

  • #583 a7be991 Thanks @lemonmade! - Improved RemoteMutationObserver to support automatic emptying and observing multiple nodes

    If you are observing a multi-node list — such as a DocumentFragment or <template> element — you can now provide a custom id option when observing each node. This allows you to treat the observer as a kind of "virtual root" for a list of nodes, similar to the role the DocumentFragment plays in the DOM. You are responsible for giving each node a unique ID, and this class will take care of correctly attaching that node to the root of the remote tree.

    const observer = new RemoteMutationObserver(connection);
    
    let id = 0;
    for (const child of documentFragment.childNodes) {
      observer.observe(child, {
        id: `DocumentFragment:${id++}`,
      });
    }

    You can also now provide an empty option to RemoteMutationObserver.disconnect() in order to clear out children in remote environment:

    const observer = new RemoteMutationObserver(connection);
    
    observer.observe(container);
    
    observer.disconnect({empty: true});
  • #583 a7be991 Thanks @lemonmade! - Expose remoteId() and setRemoteId() for getting and setting a Node's remote ID

@remote-dom/core@1.8.1

23 Jun 15:01
25c858e

Choose a tag to compare

Patch Changes

@remote-dom/core@1.8.0

17 Jun 19:13
f474f84

Choose a tag to compare

Minor Changes