Rebuild-Black-Business / RBB-Website

Website to help connect black-owned businesses with consumers and resources
https://www.rebuildblackbusiness.com/
MIT License
118 stars 73 forks source link

Implement client side routing and data fetching for individual businesses #377

Closed Mhmdabed11 closed 4 years ago

Mhmdabed11 commented 4 years ago

This PR implements client side routing and data fetching for individual businesses. So when a new business is added, users can directly visit its profile page without having to trigger a gatsby build.

Related to #374 Fixes #374

Pages/Interfaces that will change

No design changes. The url of the profile business page will now hold the id of the business in the database rather than the airtable id.

Steps to test

  1. Register a new business
  2. Visit the profile page of the business immediately and it should be working.

Additional notes

I set the refetchOnWindowFocus attribute of React Query to false since the business details in the profile page are being refetched on window focus and it was a bit misleading especially that we do not have a placeholder while the page is loading. This shows alot when the business does not exist, which in this case RQ will refetch several times before throwing an error. I am more than happy to discuss this further in case it has some use-case I am not aware of.

netlify[bot] commented 4 years ago

Deploy request for rebuild-black-business accepted.

Accepted with commit 9197f11db3a2b66b1bb7fe69cadb3c69acfe8014

https://app.netlify.com/sites/rebuild-black-business/deploys/5fac3ee15e050c0007a84ba3

magnificode commented 4 years ago

@Mhmdabed11 it does appear that we're getting a build error when testing this deployment:

Screen Shot 2020-11-11 at 8 37 39 AM

Mhmdabed11 commented 4 years ago

@Mhmdabed11 it does appear that we're getting a build error when testing this deployment:

Screen Shot 2020-11-11 at 8 37 39 AM

Ohh I guess that is because splitSlug does not exist on the server. I will look into that