Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

bug: vue swipe cancellation throws when the previous page is missing

未關閉 適合新手
#31,514 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@dandoingdev 已經在處理了。

開始於 2026年10月1日。

  • #31515 來自 @dandoingdev —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
78/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
javascript, typescript

研究方向

從 Ionic Vue IonRouterOutlet 的取消分支 swipeHandler.onEnd(false) 開始,特別檢查透過 findViewItemByRouteInfo 進行的查找。使用 npm install 和 npm run dev 執行獨立重現,然後檢查針對缺少的 view、已卸載的頁面、正常取消、已完成的滑動和延遲取消所描述的回歸覆蓋。完成的標準是:在沒有先前已掛載頁面的情況下取消仍然安全,同時現有的清理作業和已完成的滑動仍可正常運作。

由索引模型根據 Issue 內容生成。

描述

package: vue type: bug
Prerequisites
  • I have read the contributing guidelines and code of conduct.
  • I have searched existing issues for this problem.
Ionic Framework Version

v9.x

Current Behavior

Ionic Vue's IonRouterOutlet cancellation branch (swipeHandler.onEnd(false)) unconditionally dereferences the view returned by findViewItemByRouteInfo and its ionPageElement.

If the callback runs after navigation has returned to a root route, there may be no previous view in that outlet. The callback throws:

TypeError: Cannot read properties of undefined (reading 'ionPageElement')

The same branch also throws if a view record exists but its page has been unmounted. This was observed in an iOS app using 9.0.3, with the stack pointing to the cancelled-animation callback in the core router outlet. The unguarded code is still present on main at 643584b3ac2ba1ca263cbf53960ccde3be2a96fc (9.0.6).

Expected Behavior

Cancellation should safely do nothing if there is no previous mounted page to hide. When the page exists, cancellation should continue setting aria-hidden="true" and ion-page-hidden. Completed swipes should continue navigating back.

Steps to Reproduce
  1. Download the four files in the reproduction gist into one directory.
  2. Run npm install and npm run dev with a supported Node version.
  3. Open the displayed local URL and click Reproduce.
  4. Observe the TypeError in the page and console.

The reproduction uses the real Ionic Vue router and outlet. It pushes a second page, checks canStart(), returns to the first page, then explicitly delivers onEnd(false) to model a late cancellation callback. This is a deterministic callback-level reproduction, not a claim to reproduce the physical touch/animation race. There are no mocked view stacks or routers.

Code Reproduction URL

https://gist.github.com/dandoingdev/d7a6e044bf006bdb633aa32aaeffd410

Environment

Standalone reproduction: @ionic/vue 9.0.6, @ionic/vue-router 9.0.6, Vue 3.5.42, Vue Router 5.3.1, Vite 8.3.0. Confirmed in headless Chrome on macOS. No Ionic CLI or Capacitor is needed for the deterministic reproduction.

Additional Information

I have prepared a small guard for the missing view/page and regression tests, and will link the PR here. Tests cover missing views, unmounted pages, normal cancellation cleanup, completed swipes, and late cancellation after returning to the root using the real router.

主要語言
TypeScript
星號
52.7k
分支
13.3k
平均合併
2 天 8 小時
30 天內合併 PR
80

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

ionic-team/ionic-framework 的其他 Issue

查看 ionic-team/ionic-framework 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。