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(image): can't change image after set status to 'error' #67

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

huangkairan
Copy link
Contributor

@vercel
Copy link

vercel bot commented Jan 29, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/image/mylmk74d8
✅ Preview: https://image-git-fork-huangkairan-master.react-component.vercel.app

@codecov
Copy link

codecov bot commented Jan 29, 2021

Codecov Report

Merging #67 (53c192e) into master (58ec0e6) will decrease coverage by 0.40%.
The diff coverage is 50.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##            master      #67      +/-   ##
===========================================
- Coverage   100.00%   99.59%   -0.41%     
===========================================
  Files            5        5              
  Lines          247      249       +2     
  Branches        72       73       +1     
===========================================
+ Hits           247      248       +1     
- Misses           0        1       +1     
Impacted Files Coverage Δ
src/Image.tsx 98.68% <50.00%> (-1.32%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58ec0e6...a0e7320. Read the comment docs.

@shaodahong
Copy link
Member

Please add test case

@zombieJ zombieJ requested a review from shaodahong January 29, 2021 09:41
@huangkairan
Copy link
Contributor Author

Please add test case
why when I commit, see this ? I never change change the version
image

@shaodahong
Copy link
Member

This lint fails cause by eslint low version, you can use no-verify to commit

@shaodahong
Copy link
Member

git commit --no-verify

@huangkairan
Copy link
Contributor Author

git commit --no-verify

sorry, i dont know how to test my code, i never learn jest ..

@shaodahong
Copy link
Member

Please resolve conflicting

@afc163
Copy link
Member

afc163 commented Feb 1, 2021

ci broken

tests/fallback.test.tsx Outdated Show resolved Hide resolved
@huangkairan
Copy link
Contributor Author

cant test after resolved conflicts....

@@ -179,6 +179,9 @@ const ImageInternal: CompoundedComponent<ImageProps> = ({
if (isCustomPlaceholder) {
setStatus('loading');
}
if (isError) {
setStatus('normal');
Copy link
Member

Choose a reason for hiding this comment

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

有点不对这个,会把上面的状态冲掉,这个优先级比上面的低,应该放在上面

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的,我修改一下

@@ -176,6 +176,9 @@ const ImageInternal: CompoundedComponent<ImageProps> = ({
// Keep order end

React.useEffect(() => {
if (isError) {
setStatus('normal');
}
if (isCustomPlaceholder) {
setStatus('loading');
}
Copy link
Member

Choose a reason for hiding this comment

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

useEffect 依赖里是不是应该加上 isError 和 isCustomPlaceholder

Copy link
Member

Choose a reason for hiding this comment

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

这里的逻辑是 src 变化的时候重置状态,如果加上 isError isCustomPlaceholder 的依赖变化就不对了

Copy link
Contributor Author

Choose a reason for hiding this comment

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

这里只需要依赖imgSrc吧

@shaodahong shaodahong requested a review from zombieJ February 2, 2021 03:14
@huangkairan
Copy link
Contributor Author

这个bug还准备跟吗。。已经有冲突了

@huangkairan
Copy link
Contributor Author

更新了一下和主仓库的代码同步

@yoyo837 yoyo837 requested a review from shaodahong February 5, 2021 14:24
Copy link
Member

@shaodahong shaodahong left a comment

Choose a reason for hiding this comment

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

LGTM

@shaodahong shaodahong merged commit e069a77 into react-component:master Feb 5, 2021
@shaodahong
Copy link
Member

shaodahong commented Feb 7, 2021

+ [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants