Skip to content

iframe update granularity causes unintended reloads #66

Open
@cliffspradlin

Description

According to Surplus documentation, all attributes of an element are updated as part of a single generated S computation.

That's probably usually ok, and I understand from #23 (comment) the general reason for this behavior is to guarantee precedence of attributes.

However, with an iframe it seems like every time the 'src' attribute is touched (at least in Chrome), the iframe is reloaded. So even if you set a different attribute of the iframe, the iframe is always reloaded.

Demo: https://jsfiddle.net/u825n1vw/18/

It seems like a minimum viable workaround would be to have special code emitted when updating an iframe src attribute, such as:

if (iframe.src !== signal()) {
  iframe.src = signal();
}

I wonder what other side effects exist that this 'single computation' granularity would trigger. I think I'd rather give up the precedence guarantee for finer granularity.

Activity

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions