refactor: simplify preview handling and remove unnecessary code#488
Merged
Conversation
j2rong4cn
marked this pull request as draft
April 28, 2026 11:46
j2rong4cn
marked this pull request as ready for review
April 29, 2026 01:39
Member
Author
|
播放压缩包内的视频时,下一个视频会跳转到压缩包外,想着一起改了,改的地方有点多,下次吧 |
j2rong4cn
commented
Apr 29, 2026
| return getPreviews({ ...objStore.obj, provider: objStore.provider }) | ||
| }) | ||
| const selectedPreviewKey = createMemo(() => searchParams["preview"] || "") | ||
| const previews = getPreviews({ ...objStore.obj, provider: objStore.provider }) |
Member
Author
There was a problem hiding this comment.
如果使用createMemo在预览压缩包时更新objStore.obj这里也会更新,导致回到压缩包根目录
Co-authored-by: Copilot <copilot@github.com>
j2rong4cn
force-pushed
the
refactor-preview
branch
from
May 1, 2026 10:19
93e08f4 to
cf503e9
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors preview handling (notably around OpenWith and preview selection) and fixes encrypted-archive inner-file downloading by propagating the archive password into generated /ae links, while also tightening a couple of type and config edges.
Changes:
- Simplify preview component wiring by removing some memoization/prop plumbing and using the shared
OpenWithcomponent directly. - Fix encrypted archive inner-file download/link generation by carrying
passthroughArchiveObjand appending it inuseLinkfor/aeURLs. - Correct API typing for
fsArchiveListand add a TS path mapping to improvesolid-contextmenutype resolution.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds a paths mapping for solid-contextmenu typings. |
| src/utils/api.ts | Fixes fsArchiveList return type to a paged response promise. |
| src/types/obj.ts | Extends ArchiveObj with pass to carry archive passwords. |
| src/pages/home/previews/video.tsx | Adjusts Artplayer type imports. |
| src/pages/home/previews/download.tsx | Removes openWith prop/conditional OpenWith render in download preview. |
| src/pages/home/previews/archive.tsx | Refactors error handling and ensures inner-file objects carry pass; simplifies preview UI composition. |
| src/pages/home/previews/aliyun_video.tsx | Adjusts Artplayer type imports; removes unused loading binding from useFetch. |
| src/pages/home/file/open-with.tsx | Removes memoization around external preview list computation. |
| src/pages/home/file/File.tsx | Simplifies preview selection logic and removes Download openWith fallback behavior. |
| src/hooks/useLink.ts | Improves query-param concatenation and appends pass for archive inner-file links. |
| src/hooks/useFetch.ts | Adds a brief comment clarifying intended pairing with handleResp. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description / 描述
移除非必要的createMemo,因为预览文件会重载File组件
OpenList-Frontend/src/pages/home/Obj.tsx
Lines 141 to 144 in 2e0acf9
修复无法下载加密压缩包内的文件,由 #329 引入
Motivation and Context / 背景
Close #487
#446 (comment)
How Has This Been Tested? / 测试
Checklist / 检查清单
我已阅读 CONTRIBUTING 文档。
go fmtor prettier.我已使用
go fmt或 prettier 格式化提交的代码。我已为此 PR 添加了适当的标签(如无权限或需要的标签不存在,请在描述中说明,管理员将后续处理)。
我已在适当情况下使用"Request review"功能请求相关代码作者进行审查。
我已相应更新了相关仓库(若适用)。