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

Some VisibilityStates should not be emitted after INVISIBLE #1343

Open
shinwan2 opened this issue Mar 20, 2023 · 0 comments · May be fixed by #1385
Open

Some VisibilityStates should not be emitted after INVISIBLE #1343

shinwan2 opened this issue Mar 20, 2023 · 0 comments · May be fixed by #1385

Comments

@shinwan2
Copy link

Description

When the models are rebuilt, below snippets

// View is measured, process events
vi.handleVisible(epoxyHolder, detachEvent)
partialImpressionThresholdPercentage?.let { percentage ->
vi.handlePartialImpressionVisible(
epoxyHolder, detachEvent,
percentage
)
}
vi.handleFocus(epoxyHolder, detachEvent)
vi.handleFullImpressionVisible(epoxyHolder, detachEvent)

may emit events in below order

VisibilityState.INVISIBLE
VisibilityState.PARTIAL_IMPRESSION_INVISIBLE
VisibilityState.UNFOCUSED_VISIBLE

although detachEvent = true.

The screenshot below shows the call stack when the view is detached after models are rebuilt.
BugEpoxyVisibility

Suggestion

Assuming that VisiblityState.VISIBLE is the only initial state and VisibilityState.INVISIBLE the terminal state, I find the above sequence unexpected.
Shouldn't they be

VisibilityState.VISIBLE
// Some other visible states
// The user refreshes the feed 
VisibilityState.UNFOCUSED_VISIBLE
VisibilityState.PARTIAL_IMPRESSION_INVISIBLE
VisibilityState.INVISIBLE
// No other VisibilityStates

or with smaller code changes maybe we can just

VisibilityState.VISIBLE
// Some other visible states
// The user refreshes the feed 
VisibilityState.INVISIBLE
// No other VisibilityStates

Environment

Epoxy version 4.6.4

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 a pull request may close this issue.

1 participant