Commit 3fee2f7
Fix: Use action implementation at time of dispatch (facebook#29618)
Fixes the behavior of actions that are queued by useActionState to use
the action function that was current at the time it was dispatched, not
at the time it eventually executes.
The conceptual model is that the action is immediately dispatched, as if
it were sent to a remote server/worker. It's the remote worker that
maintains the queue, not the client.
This is another property of actions makes them more like event handlers
than like reducers.1 parent c600b63 commit 3fee2f7
File tree
2 files changed
+67
-12
lines changed- packages
- react-dom/src/__tests__
- react-reconciler/src
2 files changed
+67
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
1100 | | - | |
| 1100 | + | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
| |||
1128 | 1128 | | |
1129 | 1129 | | |
1130 | 1130 | | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
| 1174 | + | |
| 1175 | + | |
1131 | 1176 | | |
1132 | 1177 | | |
1133 | 1178 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1966 | 1966 | | |
1967 | 1967 | | |
1968 | 1968 | | |
1969 | | - | |
| 1969 | + | |
1970 | 1970 | | |
1971 | 1971 | | |
1972 | | - | |
| 1972 | + | |
1973 | 1973 | | |
| 1974 | + | |
| 1975 | + | |
1974 | 1976 | | |
1975 | | - | |
| 1977 | + | |
1976 | 1978 | | |
1977 | 1979 | | |
1978 | 1980 | | |
| |||
1989 | 1991 | | |
1990 | 1992 | | |
1991 | 1993 | | |
1992 | | - | |
| 1994 | + | |
1993 | 1995 | | |
| 1996 | + | |
1994 | 1997 | | |
1995 | 1998 | | |
1996 | 1999 | | |
| |||
1999 | 2002 | | |
2000 | 2003 | | |
2001 | 2004 | | |
2002 | | - | |
| 2005 | + | |
2003 | 2006 | | |
2004 | 2007 | | |
2005 | 2008 | | |
2006 | 2009 | | |
2007 | | - | |
| 2010 | + | |
2008 | 2011 | | |
| 2012 | + | |
2009 | 2013 | | |
2010 | 2014 | | |
2011 | 2015 | | |
| |||
2016 | 2020 | | |
2017 | 2021 | | |
2018 | 2022 | | |
2019 | | - | |
| 2023 | + | |
2020 | 2024 | | |
2021 | | - | |
2022 | | - | |
2023 | | - | |
2024 | 2025 | | |
2025 | 2026 | | |
2026 | 2027 | | |
| |||
2033 | 2034 | | |
2034 | 2035 | | |
2035 | 2036 | | |
| 2037 | + | |
| 2038 | + | |
| 2039 | + | |
| 2040 | + | |
| 2041 | + | |
| 2042 | + | |
| 2043 | + | |
| 2044 | + | |
| 2045 | + | |
2036 | 2046 | | |
2037 | 2047 | | |
2038 | 2048 | | |
| |||
2136 | 2146 | | |
2137 | 2147 | | |
2138 | 2148 | | |
2139 | | - | |
| 2149 | + | |
2140 | 2150 | | |
2141 | 2151 | | |
2142 | 2152 | | |
| |||
0 commit comments