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: (WaterMark) content 设置空值时,控制台存在错误提示 #6331

Merged
merged 3 commits into from
Sep 15, 2023

Conversation

liangskyli
Copy link
Contributor

@liangskyli liangskyli commented Aug 22, 2023

fix: #6332
content 设置空值时,background-image: url("");
控制台存在错误提示: 加载404,但不影响使用

<WaterMark
    content=""
  />

image
content 设置不是空值时,渲染时,也会先渲染background-image: url("");也存在控制台错误提示问题

@github-actions
Copy link
Contributor

PR preview has been successfully built and deployed to https://antd-mobile-preview-pr-6331.surge.sh

@liangskyli
Copy link
Contributor Author

关联 #6332

@@ -131,7 +131,7 @@ export const WaterMark: FC<WaterMarkProps> = p => {
style={{
zIndex,
backgroundSize: `${gapX + width}px`,
backgroundImage: `url('${base64Url}')`,
backgroundImage: base64Url === '' ? undefined : `url('${base64Url}')`,
}}
Copy link
Contributor

Choose a reason for hiding this comment

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

是什么场景会为空呀,content 判断那里?或许应该看content具体设置了什么值进去

然后应该可以setBase64Url那里处理吧

Copy link
Contributor Author

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.

详细见 #6332
后退的页面也会出现404,应该是严重的bug了

@liangskyli
Copy link
Contributor Author

liangskyli commented Aug 22, 2023 via email

@liangskyli
Copy link
Contributor Author

image base64Url默认值就是空值,导致默认url有问题,不管content是否设置了值,都存在问题的,或在base64Url不存在时,组件返回Null,不渲染元素。

@1587315093
Copy link
Contributor

i

image base64Url默认值就是空值,导致默认url有问题,不管content是否设置了值,都存在问题的,或在base64Url不存在时,组件返回Null,不渲染元素。

image base64Url默认值就是空值,导致默认url有问题,不管content是否设置了值,都存在问题的,或在base64Url不存在时,组件返回Null,不渲染元素。

是的 还是一个初始值为空的问题

@liangskyli
Copy link
Contributor Author

liangskyli commented Aug 23, 2023

这个希望先看下(页面后退的页面也会出现404应该是严重的bug了)
复现demo: https://github.com/liangskyli/umi4-bug/tree/antd-mobile-water-mark-bug

$ yarn
$ yarn start
访问:http://localhost:8000/sub-demo/page1
说明:
页面跳转使用:history.push('/page2'); 控制台会有404
页面跳转使用:window.location.href = '/sub-demo/page2'; 后退的页面也会出现404,应该是严重的bug了(电脑chore浏览器和andriod手机)

@liangskyli
Copy link
Contributor Author

@zombieJ : 有空看下这个问题,review下代码,目前临时使用pnpm patch 处理项目了

@liangskyli
Copy link
Contributor Author

这个问题有人看吗?

@codecov
Copy link

codecov bot commented Sep 15, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01% ⚠️

Comparison is base (8a3f426) 91.56% compared to head (17e103d) 91.56%.
Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6331      +/-   ##
==========================================
- Coverage   91.56%   91.56%   -0.01%     
==========================================
  Files         306      306              
  Lines        6592     6591       -1     
  Branches     1627     1627              
==========================================
- Hits         6036     6035       -1     
  Misses        521      521              
  Partials       35       35              
Files Changed Coverage Δ
src/components/water-mark/water-mark.tsx 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@zombieJ
Copy link
Member

zombieJ commented Sep 15, 2023

看了一下是初始状态时为空导致 url 访问不存在的图。我加了一个测试用例。

@zombieJ zombieJ merged commit 7a494a6 into ant-design:master Sep 15, 2023
8 checks passed
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