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

Add createBackFlow #25

Open
Olian04 opened this issue Feb 9, 2023 · 0 comments
Open

Add createBackFlow #25

Olian04 opened this issue Feb 9, 2023 · 0 comments
Assignees
Labels
further design needed This issue requires more time in the design phase

Comments

@Olian04
Copy link
Owner

Olian04 commented Feb 9, 2023

const A = createQueryAtom({
  key: 'value',
  default: 0,
});

const B = createExternalSelector({
  default: 0,
});

createBackFlow({
  from: B,
  to: A,
});

Mock implementation:

const createBackFlow = <T>(props: {
  from: ImplementsKey & ImplementsSubscribe & ImplementsGet<T>,
  to: ImplementsKey & ImplementsSet<T>, 
}) => createEffect(() => {
  props.to.set(props.from.get());
});

Real implementation should also do flow analysis to prevent cyclical dependencies (infinite loops).

@Olian04 Olian04 added enhancement New feature or request further design needed This issue requires more time in the design phase and removed enhancement New feature or request labels Feb 9, 2023
@Olian04 Olian04 self-assigned this Feb 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
further design needed This issue requires more time in the design phase
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant