Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove useTransition in favor of useNavigation #5689

Merged
merged 10 commits into from
Mar 13, 2023
Prev Previous commit
Next Next commit
Update E2E test for useTransition->useNavigation
  • Loading branch information
brophdawg11 committed Mar 10, 2023
commit 5d834705bda79896059ec4c0d5e750c13ea53ef0
41 changes: 10 additions & 31 deletions integration/navigation-state-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ test.describe("navigation states", () => {
hash: "",
state: {
_isRedirect: true,
// These were private API for transition manager that are no longer
// needed with the new router so OK to disappear
// setCookie: false,
// type: "loader",
},
key: expect.any(String),
},
Expand All @@ -275,19 +271,16 @@ test.describe("navigation states", () => {
expect(navigations).toEqual([
IDLE_STATE,
{
state: "submitting",
state: "loading",
location: {
pathname: `/${STATES.SUBMITTING_LOADER}`,
search: "?key=value",
hash: "",
state: null,
key: expect.any(String),
},
// Note: This is a bug in Remix but we're going to keep it that way
// in useTransition (including the back-compat version) and it'll be
// fixed with useNavigation
formMethod: "GET",
formAction: `/${STATES.SUBMITTING_LOADER}?key=value`,
formMethod: "get",
formAction: `/${STATES.SUBMITTING_LOADER}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
},
Expand All @@ -309,36 +302,31 @@ test.describe("navigation states", () => {
expect(navigations).toEqual([
IDLE_STATE,
{
state: "submitting",
state: "loading",
location: {
pathname: `/${STATES.SUBMITTING_LOADER_REDIRECT}`,
search: "",
hash: "",
state: null,
key: expect.any(String),
},
formMethod: "GET",
formMethod: "get",
formAction: `/${STATES.SUBMITTING_LOADER_REDIRECT}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
},
{
state: "loading",
type: "loaderSubmissionRedirect",
location: {
pathname: "/",
search: "?redirected",
hash: "",
state: {
_isRedirect: true,
// These were private API for transition manager that are no longer
// needed with the new router so OK to disappear
// setCookie: false,
// type: "loader",
},
key: expect.any(String),
},
formMethod: "GET",
formMethod: "get",
formAction: `/${STATES.SUBMITTING_LOADER_REDIRECT}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
Expand Down Expand Up @@ -367,7 +355,7 @@ test.describe("navigation states", () => {
state: null,
key: expect.any(String),
},
formMethod: "POST",
formMethod: "post",
formAction: `/${STATES.SUBMITTING_ACTION}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
Expand All @@ -381,7 +369,7 @@ test.describe("navigation states", () => {
state: null,
key: expect.any(String),
},
formMethod: "POST",
formMethod: "post",
formAction: `/${STATES.SUBMITTING_ACTION}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
Expand Down Expand Up @@ -412,7 +400,7 @@ test.describe("navigation states", () => {
state: null,
key: expect.any(String),
},
formMethod: "POST",
formMethod: "post",
formAction: `/${STATES.SUBMITTING_ACTION_REDIRECT}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
Expand All @@ -425,14 +413,10 @@ test.describe("navigation states", () => {
hash: "",
state: {
_isRedirect: true,
// These were private API for transition manager that are no longer
// needed with the new router so OK to disappear
// setCookie: false,
// type: "loader",
},
key: expect.any(String),
},
formMethod: "POST",
formMethod: "post",
formAction: `/${STATES.SUBMITTING_ACTION_REDIRECT}`,
formEncType: "application/x-www-form-urlencoded",
formData: expect.any(Object),
Expand Down Expand Up @@ -462,11 +446,6 @@ test.describe("navigation states", () => {
hash: "",
state: {
_isRedirect: true,
_isFetchActionRedirect: true,
// These were private API for transition manager that are no longer
// needed with the new router so OK to disappear
// setCookie: false,
// type: "loader",
},
key: expect.any(String),
},
Expand Down