-
Notifications
You must be signed in to change notification settings - Fork 92
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
Code review for branch feature-email-password #20
Comments
IN PROGRESS
You'll need to run
This happens only when the specific route is clicked. So most likely only once per navigation.
Fixed and added https://eslint.org/docs/rules/curly to eslint prevent this from happening again.
Added https://eslint.org/docs/2.0.0/rules/no-implicit-coercion to eslint to prevent this from happening again.
Yes that's what we decided in our previous discussion around routing. If no
config is now required.
It actually does throw if length is different as per our conversation.
After our discussion we decided to structure it that way:
|
Fix #21 |
Issues from past PR that are still there:
SuperTokensRouteWithRecipeId
insuperTokensRoute.tsx
equal to the render function of that component?New issues / questions
index.ts
of the recipe, you also need to export all the functions inside theWrapper
class, so that they can be accessed viaimport * as ___ from "..."
index.ts
of the recipe, you also need to export all the things that are outside theWrapper
class so that they can be accssed viaimport ___ from "..."
if
statements without{}
. I found one instance ingetPathsToComponentWithRecipeIdMap
insuperTokens.tsx
. Also, please use explicit comparison.. Doesif ([])
equal toif (false)
?getMatchingComponentForRouteAndRecipeId
insuperTokens.tsx
getMatchingComponentForRouteAndRecipeId
should take path asNormalisedURLPath
. Not as a string. You want to convert this class to a string as late as possible, and only if absolutely necessary.getMatchingComponentForRouteAndRecipeId
is written in a way that if arId
is provided in the URL, but that doesn't match any recipe, then we will treat it as ifrId
is not there is not there in the URL. Is this expected?canHandleRoute
, I think it's better to call thegetRoutingComponent
and check if that isundefined
or not. This way, it's guaranteed that if we change the routing algo, thencanHandleRoute
will change accordingly.new NormalisedURLPath(window.location.pathname)
into a function in utils. This way, if it turns out later thatwindow.location.pathname
is not correct, then we can easily change it. It also gives the advantage that we do not usewindow.location.pathname
without first normalising it anywhere.httpRequest.ts
, ifconfig
isundefined
, and we do...config
, will that throw an error?httpRequest.ts
, no need forsupertokens-auth-react-version
canHandleRoute
andgetRoutingComponent
inrecipeModule.ts
?signInAndUpFeature
object in theinit
call, I suggest you create a function likevalidateAndNormaliseSignInAndUpFeatureConfig
which takes what the user gave and returns the fully normalised config back which you can then propagate to the features. So this function will:onSuccessRedirectURL
to/
if the user has not provided onedisabledDefaultImplementation
, you are using the user's provided config before actually normalising it first. The first thing we want to do in the recipe is normalise all of the user's input, and add all defaults and then use that object.SignInAndUp
to a normal class that extends React? Having functions inside a function, not being able to control things likeshouldComponentUpdate
etc.. are all restrictive. I prefer to use functional component only if they are not complex.validateFormOrThrow
inutils.ts
does not throw any error.SignInAndUp
, I prefer if we first normalise (add defaults) the config / props given by the user and store the normalised version of that as an instance variable. So this way, when you are calling the signUp API, you do not have to checkif props.signUpApi === undefined
. You can just dothis.config.signUpApi(..)
.signUpApi
andsignInApi
inemailPassword.ts
do not take care of error handling?axios
orfetch
.SignInAndUp
,signInAPI
should not change state.. it should only return the response of the API call in a normalised way. We need to segregate API call layer from state layer of a component.useEffect
carefullySuperTokensRouteWithRecipeId
runs every render or every route change?fdi-version
header to requests as per Add fdi-version header to requests frontend-driver-interface#2.The text was updated successfully, but these errors were encountered: