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

515 survey overview page refactor #554

Merged

Conversation

Ankur-Datta-4
Copy link
Contributor

What does this PR do?

The survey overview page is converted to a server component and all the functions are replicated as server-actions.

Fixes #515

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • Chore (refactoring code, technical debt, workflow improvements)
  • Enhancement (small improvements)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change adds a new database migration
  • This change requires a documentation update

How should this be tested?

Since all functions are replicated we can check for:

  • Deleting Survey
  • Duplicating Survey
  • Copying Survey to other environment
  • Creating Survey with/without template

Checklist

  • Added a screen recording or screenshots to this PR
  • Filled out the "How to test" section in this PR
  • Read the contributing guide
  • Self-reviewed my own code
  • Commented on my code in hard-to-understand bits
  • Ran pnpm build
  • Checked for warnings, there are none
  • Removed all console.logs
  • Merged the latest changes from main onto my branch with git pull origin main
  • My changes don't cause any responsiveness issues
  • Updated the Formbricks Docs if changes were necessary

@vercel
Copy link

vercel bot commented Jul 14, 2023

@Ankur-Datta-4 is attempting to deploy a commit to the formbricks Team on Vercel.

A member of the Team first needs to authorize it.

@mattinannt mattinannt marked this pull request as ready for review July 14, 2023 09:05
@jobenjada jobenjada assigned jobenjada and mattinannt and unassigned jobenjada Jul 18, 2023
@Ankur-Datta-4
Copy link
Contributor Author

On making SurveyList as a server component, here's the loading UI as only the drop-down is a Client-Component.

formbricks-demo.mp4

Copy link
Member

@mattinannt mattinannt left a comment

Choose a reason for hiding this comment

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

@Ankur-Datta-4 thanks a lot for the changes 😊 Looks pretty good and works great!
Since we are still looking for the best structure to work with server actions and our new service infrastructure, I made some changes to make a clear difference between Survey and SurveyWithAnalytics.

I also tried different approaches to call the service (e.g. createSurvey) directly in the client component instead of making a d-tour with an actions.ts file.
The problem is that a server action called inside a client component must be use server', which comes with restrictions on how the file looks (e.g. it can only export functions). Since this limits the way we can build the services, I decided to now always go through the actions.ts' file (e.g. createSurveyAction()) but then call the generic service, so it's easier to reuse code/services we need in more than one place, but also keep server actions in one place.

Since I also made some changes, I would like to ask @jobenjada for a quick review to check if everything works.

Copy link
Member

@jobenjada jobenjada left a comment

Choose a reason for hiding this comment

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

works great!

@jobenjada jobenjada merged commit cf953db into formbricks:main Jul 20, 2023
0 of 2 checks passed
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.

[FEATURE] Move Survey Overview Page to Server Components
3 participants