Skip to content

feat(region): Hide annotations if visibility is false#483

Merged
mergify[bot] merged 3 commits intobox:masterfrom
mingzexiao6:fix-visibility
May 11, 2020
Merged

feat(region): Hide annotations if visibility is false#483
mergify[bot] merged 3 commits intobox:masterfrom
mingzexiao6:fix-visibility

Conversation

@mingzexiao6
Copy link
Contributor

@mingzexiao6 mingzexiao6 commented May 8, 2020

  • Tests

@mingzexiao6 mingzexiao6 requested a review from a team as a code owner May 8, 2020 20:45
if (!this.rootEl) {
return;
}
if (visibility) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be handled by the parent at this point?

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we're using redux to store the state, but not relying on it to hide and show the annotations, but rather rely on the value passed into setVisibility. What are your thoughts on having RegionContainer connect to this state and have RegionAnnotations use that as a basis to render RegionList?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems like we're using redux to store the state, but not relying on it to hide and show the annotations, but rather rely on the value passed into setVisibility. What are your thoughts on having RegionContainer connect to this state and have RegionAnnotations use that as a basis to render RegionList?

Jared thinks this logic should live in the higher level. Otherwise we'll have to replicate this logic for all future annotation types.

if (!this.rootEl) {
return;
}
if (visibility) {
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like we're using redux to store the state, but not relying on it to hide and show the annotations, but rather rely on the value passed into setVisibility. What are your thoughts on having RegionContainer connect to this state and have RegionAnnotations use that as a basis to render RegionList?

@@ -120,7 +120,14 @@ export default class BaseAnnotator {
};

setVisibility = (visibility: boolean): void => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

isVisible

describe('setVisibility()', () => {
test.each([true, false])('should dispatch setVisibilityAction with visibility %p', visibility => {
test.each([true, false])('should hide/show annotations if visibility is %p', visibility => {
annotator.rootEl = defaults.container;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably just call annotator.init(1) to set up the annotator properly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably just call annotator.init(1) to set up the annotator properly.

If call init but not set rootEl explicitly, eslint will throw error annotator.rootEl is possibly null

@mergify mergify bot merged commit bb13aac into box:master May 11, 2020
@mingzexiao6 mingzexiao6 deleted the fix-visibility branch August 13, 2020 00:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants