Skip to content
This repository has been archived by the owner on Aug 19, 2023. It is now read-only.

Router Refactor: Conditional Route Logic #560

Open
larsmaxwell opened this issue Aug 17, 2022 · 0 comments
Open

Router Refactor: Conditional Route Logic #560

larsmaxwell opened this issue Aug 17, 2022 · 0 comments
Labels
VA Forms System Core For Forms Library Team work on the new VA Forms System Core

Comments

@larsmaxwell
Copy link
Contributor

  1. Conditional Path logic
    RouterContext uses conditional path property (ln 33)
const conditionalPath =
        ((current?.element as ReactElement)?.props as { type: string })
          ?.type === 'conditional';

instead of just checking for the existence of a conditional property:

      const condition = (
        (current?.element as ReactElement)?.props as { condition: string }
      )?.condition;
  1. RouterContext.tsx currently uses useField when you could probably hook into the Formik context to get the field value. Determine which method is least expensive, and change it if necessary:
    const field = condition ? useField(condition) : null;
@larsmaxwell larsmaxwell added the VA Forms System Core For Forms Library Team work on the new VA Forms System Core label Aug 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
VA Forms System Core For Forms Library Team work on the new VA Forms System Core
Projects
None yet
Development

No branches or pull requests

1 participant