Commit 36aee8d
committed
Recover from blocking routes under Instant Navigation lock when deployed
The Instant Navigation feature locks navigation to a route's static
shell so you can inspect the prefetched shell before any dynamic content
streams in. It is controlled by a cookie: in development the Instant
Navigation DevTools set and clear it for you, and in any environment you
can drive it by hand by setting the cookie in the browser's DevTools. A
blocking route (one with a Suspense boundary above `<body>`, or `export
const instant = false`) has an empty static shell, so when you do a full
page load of such a route while the cookie is set, that empty shell is
served as a blank document with no way to release the lock, and every
reload renders the same blank shell and leaves you stuck.
Previously the handler threw for an empty shell. In development that
surfaces as the error overlay, which is what we want, and the catch
clears the cookie so a reload recovers. It did not recover when
deployed: the cookie could only be cleared via `Set-Cookie`, which
cannot take effect there because the empty shell is served from the ISR
cache with its response headers already committed, so the user stayed on
the blank shell across reloads. In `next start` it recovered but
rendered only a generic "Internal Server Error" page.
With this change a deployed blocking route recovers. For the empty-shell
case we serve a minimal document whose inline script clears the cookie
client-side, so the next full page load renders the route normally; we
clear it from the document rather than with `Set-Cookie` because the
headers are already committed when the shell is served from the cache.
Development still throws so the error overlay shows. As a secondary
improvement, `next start` now serves that same document with a readable
explanation instead of the generic "Internal Server Error" page.
The blocking-route test now asserts the user-facing outcome (after a
reload the route renders normally) rather than transport details such as
the status code and `Set-Cookie`, which legitimately differ across dev,
`next start`, and deploy, and it runs on deploy as well.1 parent 7e29e40 commit 36aee8d
2 files changed
Lines changed: 109 additions & 57 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1755 | 1755 | | |
1756 | 1756 | | |
1757 | 1757 | | |
1758 | | - | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
| 1761 | + | |
| 1762 | + | |
| 1763 | + | |
| 1764 | + | |
| 1765 | + | |
| 1766 | + | |
1759 | 1767 | | |
1760 | 1768 | | |
1761 | 1769 | | |
| |||
1875 | 1883 | | |
1876 | 1884 | | |
1877 | 1885 | | |
1878 | | - | |
1879 | | - | |
1880 | | - | |
1881 | | - | |
1882 | | - | |
1883 | | - | |
1884 | | - | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
1885 | 1890 | | |
1886 | | - | |
1887 | | - | |
1888 | | - | |
1889 | | - | |
1890 | | - | |
1891 | | - | |
1892 | | - | |
1893 | | - | |
1894 | | - | |
1895 | | - | |
| 1891 | + | |
1896 | 1892 | | |
1897 | 1893 | | |
1898 | | - | |
1899 | | - | |
1900 | | - | |
1901 | | - | |
1902 | | - | |
| 1894 | + | |
| 1895 | + | |
| 1896 | + | |
| 1897 | + | |
| 1898 | + | |
| 1899 | + | |
| 1900 | + | |
| 1901 | + | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
| 1909 | + | |
| 1910 | + | |
| 1911 | + | |
| 1912 | + | |
| 1913 | + | |
| 1914 | + | |
| 1915 | + | |
| 1916 | + | |
| 1917 | + | |
| 1918 | + | |
| 1919 | + | |
| 1920 | + | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
1903 | 1935 | | |
1904 | 1936 | | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
1905 | 1942 | | |
1906 | 1943 | | |
1907 | 1944 | | |
| |||
Lines changed: 49 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | 29 | | |
31 | 30 | | |
32 | 31 | | |
| |||
1050 | 1049 | | |
1051 | 1050 | | |
1052 | 1051 | | |
1053 | | - | |
1054 | | - | |
1055 | | - | |
1056 | | - | |
1057 | | - | |
1058 | | - | |
1059 | | - | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | | - | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
1078 | | - | |
1079 | | - | |
1080 | | - | |
1081 | | - | |
1082 | | - | |
1083 | | - | |
1084 | | - | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
| 1059 | + | |
| 1060 | + | |
| 1061 | + | |
| 1062 | + | |
| 1063 | + | |
| 1064 | + | |
| 1065 | + | |
| 1066 | + | |
| 1067 | + | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
1085 | 1073 | | |
1086 | | - | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
| 1081 | + | |
| 1082 | + | |
| 1083 | + | |
| 1084 | + | |
| 1085 | + | |
| 1086 | + | |
| 1087 | + | |
| 1088 | + | |
| 1089 | + | |
| 1090 | + | |
| 1091 | + | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
1087 | 1102 | | |
1088 | 1103 | | |
1089 | 1104 | | |
| |||
0 commit comments