-
-
Notifications
You must be signed in to change notification settings - Fork 99
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
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/react-component/image/mylmk74d8 |
Codecov Report
@@ 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
Continue to review full report at Codecov.
|
Please add test case |
This lint fails cause by eslint low version, you can use no-verify to commit |
|
sorry, i dont know how to test my code, i never learn jest .. |
Please resolve conflicting |
ci broken |
cant test after resolved conflicts.... |
@@ -179,6 +179,9 @@ const ImageInternal: CompoundedComponent<ImageProps> = ({ | |||
if (isCustomPlaceholder) { | |||
setStatus('loading'); | |||
} | |||
if (isError) { | |||
setStatus('normal'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
有点不对这个,会把上面的状态冲掉,这个优先级比上面的低,应该放在上面
There was a problem hiding this comment.
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'); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useEffect 依赖里是不是应该加上 isError 和 isCustomPlaceholder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里的逻辑是 src 变化的时候重置状态,如果加上 isError
isCustomPlaceholder
的依赖变化就不对了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里只需要依赖imgSrc吧
这个bug还准备跟吗。。已经有冲突了 |
更新了一下和主仓库的代码同步 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
�fix: ant-design/ant-design#29112