Skip to content

Conversation

@google-labs-jules
Copy link
Contributor

Fixes #129


PR created automatically by Jules for task 589115529696734984

在載入學習模式頁面時,`updateUrlForCategory` 函式會不當地清除 `musiid` 參數,導致使用者設定的查詢模式遺失。

本提交移除了 `updateUrlForCategory` 函式中刪除 `musiid` 參數的程式碼,確保在不同頁面模式之間切換時,查詢模式的設定能夠透過 URL 參數正確地保留下來。
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Sep 25, 2025

Deploying hakspring with  Cloudflare Pages  Cloudflare Pages

Latest commit: 60b2b14
Status: ✅  Deploy successful!
Preview URL: https://3eab9185.hakspring.pages.dev
Branch Preview URL: https://fix-search-mode-url-param-pe.hakspring.pages.dev

View logs

@Aiuanyu
Copy link
Owner

Aiuanyu commented Sep 25, 2025

𠊎再過確認一下敢做得穩定重現。你改个像形做毋得,因為本旦就愛在載入學習詞表時節拿忒查詞相關參數。

@Aiuanyu Aiuanyu changed the title Pull request for issue #129 #129 → 維持查詞參數指定个設定 Sep 25, 2025
@google-labs-jules
Copy link
Contributor Author

𠊎再過確認一下敢做得穩定重現。你改个像形做毋得,因為本旦就愛在載入學習詞表時節拿忒查詞相關參數。

多謝指點!原來我誤會了。我會先還原先前的修改,然後改用另一種方式來處理:在 URL 包含 musiid 參數時,我會將該設定儲存到 localStorage。這樣一來,即使 musiid 參數後來被移除,查詢模式的設定依然能被保留下來。我馬上就來修改。

先前的修復方向有誤。根據使用者的回饋,正確的作法應為:當 URL 首次載入並包含 `musiid` 參數時,將對應的查詢模式(「客話」或「華語」)寫入 `localStorage` 的 `lastSearchMode` 中。

本提交在 `handleUrlChange` 函式中加入了這個邏輯,確保即使 `musiid` 參數後續因頁面操作而被移除,其指定的查詢模式也能被正確地記住並在後續操作中得到保留。
@Aiuanyu
Copy link
Owner

Aiuanyu commented Sep 25, 2025

你敢看得著 https://raw.githubusercontent.com/Aiuanyu/HakSpring/0be59c68dec9ba2f863c2efa105aaeffdee2063d/main.js 這裡背係仰般處理个?該時節係毋係應該早就無問題?

@Aiuanyu
Copy link
Owner

Aiuanyu commented Sep 25, 2025

kiong 還有 musiid 參數个處理其實都應該愛共樣毋係

@google-labs-jules
Copy link
Contributor Author

你敢看得著 https://raw.githubusercontent.com/Aiuanyu/HakSpring/0be59c68dec9ba2f863c2efa105aaeffdee2063d/main.js 這裡背係仰般處理个?該時節係毋係應該早就無問題?

多謝您提供歷史版本的程式碼!我詳細比對後發現了問題的根源。

在您提供的 0be59c68d 版本中,查詢模式的設定是直接在 if (musiidParam && caParam) 區塊內完成的。然而,在目前的版本中,這段邏輯被移到了函式的最開頭,並且會優先讀取 localStorage 中的 lastSearchMode

這就產生了一個問題:當使用者透過一個包含 musiid=zh 的學習書籤進入頁面時,雖然當下的 UI 會正確顯示,但 localStorage 中可能還儲存著舊的「客話」設定。當使用者進行其他操作(例如選擇一個學習類別)時,updateUrlForCategory 函式會(正確地)移除 URL 中的 musiid 參數。在這種情況下,如果使用者再次打開查詢框,程式就會讀取到 localStorage 中那個舊的「客話」設定,而不是書籤中指定的「華語」。

因此,我先前提交的修復(在偵測到 musiid 參數時,將其值寫入 localStorage)是為了解決這個狀態不一致的問題。這個修改可以確保 URL 參數的優先級高於 localStorage 中的舊設定,並將新的設定持久化。我會繼續完成這個修復。

@google-labs-jules
Copy link
Contributor Author

kiong 還有 musiid 參數个處理其實都應該愛共樣毋係

您講个著!為著保持一致性,kiong(腔調)參數確實應該和 musiid(查詢模式)參數一樣,在透過 URL 指定時,將其設定寫入 localStorage。我會馬上修改程式碼,加入這個邏輯,然後再重新提交。多謝您的指點!

根據使用者回饋,除了 `musiid` 參數外,`kiong`(腔調)參數也應在透過 URL 指定時,將其設定寫入 `localStorage`,以保持行為一致性。

本提交在 `handleUrlChange` 函式中加入了對 `musiid` 和 `kiong` 兩個參數的 `localStorage` 寫入邏輯。這確保了當使用者透過 URL 參數指定查詢模式或腔調時,這些設定會被正確地儲存起來,並在後續操作中得到保留。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

查詞模式還係無照 URL 參數

2 participants