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

Fix new accent color not refreshing when changing thumbnail for audio uploads #14264

Merged

Conversation

ClearlyClaire
Copy link
Contributor

The props are correctly passed down to the audio player, but the canvas doesn't get redrawn unless it is currently playing.
This PR changes that.

@@ -103,7 +103,7 @@ class Audio extends React.PureComponent {
}

componentDidUpdate (prevProps, prevState) {
if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height) {
if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height || prevProps.accentColor !== this.props.accentColor) {
Copy link
Member

Choose a reason for hiding this comment

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

Hmm I suppose this needs take background and foreground colors into account too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, those are properly passed down, and not part of the canvas.

Copy link
Member

Choose a reason for hiding this comment

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

Wait, we should just make a poster check. The colors can't change unless the poster image changed.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, only accentColor gets drawn currently. I see what you mean now. Yeah this makes sense then.

@@ -103,7 +103,7 @@ class Audio extends React.PureComponent {
}

componentDidUpdate (prevProps, prevState) {
if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height) {
if (prevProps.src !== this.props.src || this.state.width !== prevState.width || this.state.height !== prevState.height || prevProps.accentColor !== this.props.accentColor) {
Copy link
Member

Choose a reason for hiding this comment

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

Wait, we should just make a poster check. The colors can't change unless the poster image changed.

@Gargron Gargron merged commit 0d2135a into mastodon:master Jul 8, 2020
abcang pushed a commit to abcang/mastodon that referenced this pull request Jul 11, 2020
shouo1987 pushed a commit to CrossGate-Pawoo/mastodon that referenced this pull request Dec 7, 2022
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.

None yet

2 participants