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

CircuitX - ImpressionEffect #1008

Merged
merged 10 commits into from
Nov 27, 2023
Merged

CircuitX - ImpressionEffect #1008

merged 10 commits into from
Nov 27, 2023

Conversation

stagg
Copy link
Collaborator

@stagg stagg commented Nov 22, 2023

Changes

  • Adding some specific side-effects for use with clogging/analytics, typically for use in circuit presenters
  • ImpressionEffect: A side effect that will run an impression once based on the retain strategy
  • LaunchedImpressionEffect: A [LaunchedEffect] that will run a suspendable impression once, based on the retain strategy
  • rememberImpressionNavigator: A [LaunchedImpressionEffect] that will also re-run the impression if it re-enters the composition after a navigation event.

@stagg stagg marked this pull request as ready for review November 22, 2023 00:57
@stagg stagg requested review from ZacSweers and kierse November 22, 2023 00:57
Copy link
Collaborator

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests are excellent! I do have a concern about them though - currently we don't run instrumentation tests on CI (we moved everything to robolectric). Is it possible to do that here? Relatedly, is it possible to test (a subset) of the impl in common tests for more multiplatform coverage?

Some other thoughts

  • are we married to "sideffects" or should we just call it "effects"?
  • I'm somewhat of the mind that we should actually make this a core circuit library, I think this pretty quickly becomes required for any app using Circuit
  • Do you think we should account for LocalPinnedContainer (per our offline discussions wrt event listeners) here?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chefskiss.png

@ZacSweers ZacSweers changed the title CircuitX - ImpressionEffect's CircuitX - ImpressionEffect Nov 25, 2023
@stagg
Copy link
Collaborator Author

stagg commented Nov 26, 2023

The tests are excellent! I do have a concern about them though - currently we don't run instrumentation tests on CI (we moved everything to robolectric). Is it possible to do that here? Relatedly, is it possible to test (a subset) of the impl in common tests for more multiplatform coverage?

Turns out, we can! Interesting use of molecule and some expect/actual to get it all working though. Did that with c04d79f.

  • are we married to "sideffects" or should we just call it "effects"?

Nope effects is better 👍🏻 162fd21

  • I'm somewhat of the mind that we should actually make this a core circuit library, I think this pretty quickly becomes required for any app using Circuit

I think for the basic circuit use it's fine to not have it in foundation, and have it as an extension for advanced use. Don't really mind either way though 🤷🏻

  • Do you think we should account for LocalPinnedContainer (per our offline discussions wrt event listeners) here?

Uses of this should be very deliberate so I don't think we need to do any extra support for sub-circuit use with this.
That said, added a test for the impression in a lazy container with 895b735

Copy link
Collaborator

@ZacSweers ZacSweers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

Approving but could you add small doc to circuitx docs for the site before you merge?

@stagg stagg added this pull request to the merge queue Nov 27, 2023
Merged via the queue into main with commit ee394e3 Nov 27, 2023
@stagg stagg deleted the js-impression-effects branch November 27, 2023 22:16
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