Skip to content

input value bug #86

@stevekrouse

Description

@stevekrouse

This example expects the inputs to mirror each other. This behavior works in the beginning. You can pick either input box and change the value and it will mirror in the other. But if you modify the other, it won't change in the other one. And if you go back to the first one, it won't change the other anymore. Yet, when you put the behavior in another element (such as an span), it reflects that the stream is working correctly.

import { combine, sample, changes, stepper } from "@funkia/hareactive";
import { runComponent, elements, modelView, fgo, go } from "@funkia/turbine";
const { input, span } = elements;

const tempModel = fgo(function*({ val1_, val2_ }) {
  const v = yield sample(stepper(0, combine(changes(val1_), changes(val2_))));
  return { v };
});
const tempView = ({ v }) =>
  go(function*() {
    yield span(v);
    const { inputValue: val1_ } = yield input({ value: v });
    const { inputValue: val2_ } = yield input({ value: v });
    return { val1_, val2_ };
  });
const temp = modelView(tempModel, tempView);

runComponent("#app", temp());

https://codesandbox.io/s/rrwlvx41pq

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions