Commit 477032f
committed
fix(app-router): pass searchParams to layout generateMetadata
Layout `generateMetadata()` was always called with `undefined` for
`searchParams` because `spObj` (the URLSearchParams-to-plain-object
conversion) was constructed after the layout metadata loop. Hoist the
`spObj` construction to before the loop so every layout receives the
real query parameters — matching the behaviour already correct for the
page segment.
Adds a regression fixture (`layout-metadata-search`) and a test that
requests `/layout-metadata-search?tab=settings` and asserts the layout's
`generateMetadata` title reflects the query param value rather than the
undefined-fallback default.1 parent 7c5ca2f commit 477032f
4 files changed
Lines changed: 61 additions & 17 deletions
File tree
- packages/vinext/src/entries
- tests
- fixtures/app-basic/app/layout-metadata-search
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
955 | 955 | | |
956 | 956 | | |
957 | 957 | | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
958 | 975 | | |
959 | 976 | | |
960 | 977 | | |
| |||
966 | 983 | | |
967 | 984 | | |
968 | 985 | | |
969 | | - | |
| 986 | + | |
970 | 987 | | |
971 | 988 | | |
972 | 989 | | |
| |||
977 | 994 | | |
978 | 995 | | |
979 | 996 | | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
985 | | - | |
986 | | - | |
987 | | - | |
988 | | - | |
989 | | - | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
994 | | - | |
995 | | - | |
996 | 997 | | |
997 | 998 | | |
998 | 999 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
877 | 877 | | |
878 | 878 | | |
879 | 879 | | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
880 | 893 | | |
881 | 894 | | |
882 | 895 | | |
| |||
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
0 commit comments