fix: ページネーション遷移で検索キーワード等が引き継がれない不具合を修正 - #189
Merged
Merged
Conversation
`$keyword`/`$paks`/`$sites`が`#[Url]`化されておらず、ページネーションリンク (プレーンな`<a href>`によるURL遷移)にも検索条件が乗っていなかったため、 2ページ目以降に遷移すると検索条件がリセットされた状態でコンポーネントが 再マウントされていた(#187/#188のセルフレビューで発見していた既知の制限)。 - `$keyword`/`$paks`/`$sites`に`#[Url]`を追加し、フルページ遷移後も URLから状態を復元できるようにした - `pages()`が返すpaginatorに`->appends([...])`で現在の検索条件を明示的に 付与し、生成されるページネーションリンクに検索条件が引き継がれるように した。`withQueryString()`はLivewireのAJAXリクエスト中は `request()->query()`(アドレスバーではなくAJAXエンドポイント自体の クエリ文字列)を参照してしまい正しく機能しないため、コンポーネントの プロパティから直接構築する方式にした - 回帰テストを追加(ページネーションリンクにkeyword/paksが実際に 含まれることを確認) なお既存テストの正規表現がクエリパラメータの並び順・エスケープ形式 (`&`ではなくBladeでエスケープされた`&`)に依存していたため、 より頑健な形に合わせて修正した。
Owner
Author
|
セルフレビュー実施。 確認した内容
指摘事項なし。 |
6 tasks
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.
Summary
$keyword/$paks/$sitesが#[Url]化されておらず、ページネーションリンク(プレーンな<a href>によるURL遷移)にも検索条件が乗っていなかったため、2ページ目以降に遷移すると検索条件がリセットされた状態でコンポーネントが再マウントされていました(#187/#188のセルフレビューで発見していた既知の制限です)。$keyword/$paks/$sitesに#[Url]を追加し、フルページ遷移後もURLから状態を復元できるようにしました。pages()が返すpaginatorに->appends([...])で現在の検索条件を明示的に付与し、生成されるページネーションリンクに検索条件が引き継がれるようにしました。withQueryString()はLivewireのAJAXリクエスト中はrequest()->query()(アドレスバーではなくAJAXエンドポイント自体のクエリ文字列)を参照してしまい正しく機能しないため、コンポーネントのプロパティから直接構築する方式にしています。keyword/paksが実際に含まれることを確認)。なお既存テストの正規表現がクエリパラメータの並び順・エスケープ形式(
&ではなくBladeでエスケープされた&)に依存していたため、より頑健な形に修正しています。Test plan
./vendor/bin/pint --test./vendor/bin/phpstan analyse(全体、エラーなし)./vendor/bin/rector process --dry-run(提案なし)php artisan test(66件全て通過。新規回帰テストで、2ページ目リンクにkeyword=Locomotiveとpaks%5B64%5D=0が実際に含まれることを確認)🤖 Generated with Claude Code