Skip to content

Conversation

@vikasrohit
Copy link

fyi @maxceem

@vikasrohit vikasrohit merged commit 8fbc21b into dev Feb 20, 2020
// set timeout for raising alert to refresh the token 2 minutes before the session expire
timer = setTimeout(() => {
console.log('Calling refresh looker session action')
thisRef.props.refreshLookerSession()
Copy link
Collaborator

Choose a reason for hiding this comment

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

hint: this inside arrow functions () => {} always point to the outer this, so we don't have to use thisRef and can use this instead, it would work.

@vikasrohit fyi

Copy link
Author

Choose a reason for hiding this comment

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

I always found the this in side the native javascript methods (like setTimeout), ambiguous. But as it is working for this case as you suggested and I double checked, I am removing the need of this Ref.

return !props.isLoading
})(LookerEmbedReport)

let timer
Copy link
Collaborator

Choose a reason for hiding this comment

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

Generally, it's safer to keep timer inside class like this.timer. Otherwise, if we have 2 components on one page, they would use the same timer and break each other.

fyi @vikasrohit

Copy link
Author

Choose a reason for hiding this comment

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

Agreed. I placed it intentionally outside because I do want to use the same time for all reporting components on the same page.
However, on second thought, I think we can move it to inside the class for better reading because I don't expect multiple copies of this component on the same page.

@vikasrohit vikasrohit deleted the feature/reporting_poc branch February 21, 2020 06:00
@vikasrohit
Copy link
Author

Implemented both suggestions. Thanks @maxceem

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.

3 participants