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

feat: add error handling for selected projects that do not have protection enabled #7566

Open
wants to merge 11 commits into
base: master
Choose a base branch
from

Conversation

rusticpenguin
Copy link
Contributor

Purpose

When a user selects a project, that project may not be setup correctly to be displayed in our Preview. We require the project to have protection bypass enabled.

Approach

  • Add logic around checking if the protection bypass is enabled
  • Add case to the error reducer

Testing steps

  1. Go to Vercel and disable protection bypass for your project
  2. Go to your app's config page
  3. Select the project with the disabled protection bypass
  4. Verify the error message appears below the project selector

Copy link

netlify bot commented May 3, 2024

Deploy Preview for ecommerce-app-base-components ready!

Name Link
🔨 Latest commit 623b890
🔍 Latest deploy log https://app.netlify.com/sites/ecommerce-app-base-components/deploys/66608a7dd6baaf0008d5c007
😎 Deploy Preview https://deploy-preview-7566--ecommerce-app-base-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@rusticpenguin rusticpenguin marked this pull request as ready for review May 8, 2024 16:05
@rusticpenguin rusticpenguin requested a review from a team as a code owner May 8, 2024 16:05
@rusticpenguin rusticpenguin changed the title Feat/integ 2073 feat: @rusticpenguin feat: add error handling for selected projects that do not have protection enabled May 8, 2024
@rusticpenguin rusticpenguin changed the title feat: @rusticpenguin feat: add error handling for selected projects that do not have protection enabled feat: add error handling for selected projects that do not have protection enabled May 8, 2024
Copy link
Contributor

@lilbitner lilbitner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great George! Thanks for adding those awaits and for always adding clean and readable code.
In terms of functionality, when I test it out locally, I am seeing some clobbering logic within the ProjectSelectionSection file. The two useEffects are essentially overriding each other so the error is not persisting in the UI (as the bypass error is cleared by the validateProjectEnv method. I think we should still follow an approach that there should only exist one error at a time for the project selection step, so perhaps we can combine the useEffects and make the steps sequential in some way? i.e we check that the project has a valid spaceId and then if so, check the bypass token? or vise versa? Also feel free to adjust the logic in the validateProjectEnv method, as it clears all errors if the spaceId is valid, which may not be necessary?

@rusticpenguin rusticpenguin force-pushed the feat/INTEG-2073 branch 2 times, most recently from ecfd196 to fb5fd79 Compare May 16, 2024 15:33
Copy link
Contributor

@lilbitner lilbitner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving one comment, curious your thoughts!! (more a UX thing). Awesome work!

@@ -158,6 +153,7 @@ const ConfigScreen = () => {
renderPostAuthComponents &&
!errors.projectSelection.projectNotFound &&
!errors.projectSelection.cannotFetchProjects &&
!errors.projectSelection.protectionBypassIsDisabled &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be fine to follow the pattern here that we still render the next section even if this error exists, because it is simply a setting they have to change. Just like we allow them to continue to select the next section if the projectSelection.invalidSpaceId is true (which is a setting they need to change). Or perhaps we choose one line of logic or the other! wdyt? See video below for more context (on the weird standard we have for one but not the other). We kind of already have a pattern where things will NOT work with certain configurations but we still allow them to save most of the changes (i.e in the content type/preview path section we allow them to save empty fields even though that clearly won't work).

Screen.Recording.2024-05-16.at.12.53.17.PM.mov

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good with me!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

perhaps we remove this line from the conditional then?

@jsdalton jsdalton self-requested a review June 5, 2024 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants