Skip to content

fix: 优化image和video缓存机制 - #3345

Merged
Alexzjt merged 1 commit into
nextfrom
feat/imageRenderCacheOptimize
May 14, 2026
Merged

Alexzjt merged 1 commit into
nextfrom
feat/imageRenderCacheOptimize

Conversation

@xxxxZ-zhang

Copy link
Copy Markdown
Contributor

👀 PR includes

✨ Feature

  • New feature

🎨 Enhance

  • Code style optimization
  • Refactoring
  • Change the UI
  • Improve the performance
  • Type optimization

🐛 Bugfix

  • Solve the issue and close

🔧 Chore

  • Test case
  • Docs / demos update
  • CI / workflow
  • Release version
  • Other ()

📝 Description

现状:一个链接为视频的字段设置渲染为图片,在单元格中会渲染兜底图,此时不刷新页面更新设置为视频渲染,由于缓存的关系,仍然渲染的是兜底图

🖼️ Screenshot

Before After
❌ ✅

⚠️ Breaking Changes

  • Yes
  • No

🔗 Related issue link

🔍 Self-Check before the merge

  • Add or update relevant docs.
  • Add or update relevant demos.
  • Add or update test case.
  • Add or update relevant TypeScript definitions.

@github-actions

Copy link
Copy Markdown
Contributor

你好 @xxxxZ-zhang,非常感谢你的贡献.
为了让代码更健壮, 请根据 贡献指南 补充相应单元测试 (文档改动或其他特殊场景除外), 如果有 API 改动, 请修改 相应的文档.
同时请检查 lint 和 test 相关 CI 是否通过, 如果失败, 请点击 [Details] 按钮查看, 并根据日志修复.

Hello, @xxxxZ-zhang, Thanks for your contribution. In order to make the code more robust, please add the corresponding unit tests, and update the docs if there are API changes.
At the same time, please check whether the CI related to lint and test passes. If the CI fails, please click [Details] button to check and repair according to the log.

@github-actions github-actions Bot added pr(feature) new feature next 2.0-next 版本的问题 labels May 13, 2026
@github-actions
github-actions Bot requested a review from Alexzjt May 13, 2026 06:07

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a prefixed caching mechanism for media assets by adding a getCacheKey utility and updating the ImageRenderer, VideoRenderer, and asyncDrawImage functions. The review identified regressions in cache handling: the updated logic fails to account for cached null values (indicating previous load failures) and fallback images, which leads to redundant network requests. Suggestions were provided to restore proper handling for these cases to ensure performance and consistency.

@codecov-commenter

codecov-commenter commented May 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 58.06452% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.54%. Comparing base (ecdc9c8) to head (dc51b99).
⚠️ Report is 804 commits behind head on next.

Files with missing lines Patch % Lines
packages/s2-core/src/renderer/VideoRenderer.ts 30.76% 7 Missing and 2 partials ⚠️
packages/s2-core/src/utils/cell/customRenderer.ts 73.33% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3345      +/-   ##
==========================================
+ Coverage   75.77%   78.54%   +2.77%     
==========================================
  Files         257      224      -33     
  Lines       11994    12544     +550     
  Branches     2464     2852     +388     
==========================================
+ Hits         9088     9853     +765     
+ Misses       1398      975     -423     
- Partials     1508     1716     +208     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

github-actions Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: +220 B (+0.03%)

Total Size: 745 kB

📦 View Changed
Filename Size Change
packages/s2-core/dist/s2-extends.min.js 209 kB +116 B (+0.06%)
packages/s2-core/dist/s2.min.js 312 kB +104 B (+0.03%)
ℹ️ View Unchanged
Filename Size
packages/s2-core/dist/s2.min.css 581 B
packages/s2-react-components/dist/s2-react-components.min.css 2.55 kB
packages/s2-react-components/dist/s2-react-components.min.js 123 kB
packages/s2-react/dist/s2-react.min.css 1.3 kB
packages/s2-react/dist/s2-react.min.js 38.5 kB
packages/s2-vue/dist/s2-vue.min.css 3.8 kB
packages/s2-vue/dist/s2-vue.min.js 54.2 kB

compressed-size-action

@xxxxZ-zhang
xxxxZ-zhang force-pushed the feat/imageRenderCacheOptimize branch from 5051ad8 to dc51b99 Compare May 14, 2026 02:11
@Alexzjt
Alexzjt merged commit c17b767 into next May 14, 2026
9 checks passed
@Alexzjt
Alexzjt deleted the feat/imageRenderCacheOptimize branch May 14, 2026 02:33
@Alexzjt Alexzjt changed the title feat: 优化image和video缓存机制 fix: 优化image和video缓存机制 May 14, 2026
@github-actions github-actions Bot added pr(fix) bug fix and removed pr(feature) new feature labels May 14, 2026
Alexzjt pushed a commit that referenced this pull request May 14, 2026
Co-authored-by: 张斌 <zb01704480@antgroup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

next 2.0-next 版本的问题 pr(fix) bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants