Skip to content

Commit 49c63ed

Browse files
rmnpptRoman Popat
andauthored
Fix/single source state (#49)
* single source of state * CI/CD bugs --------- Co-authored-by: Roman Popat <roman.popat@proton.me>
1 parent a49f503 commit 49c63ed

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

.github/workflows/build-deploy-merge.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ jobs:
4646
credentials_json: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_BS3APP_DFB63 }}'
4747

4848
- name: Deploy functions
49-
run: firebase deploy --only functions --project bs3app-dfb63
49+
run: firebase deploy --only functions --project bs3app-dfb63 --force
5050
working-directory: ./bs3-functions
5151
env:
52-
PERPLEXITY_SONAR_API_KEY: ${{ secrets.PERPLEXITY_SONAR_API_KEY }}
52+
PERPLEXITY_SONAR_API_KEY: dummy-api-key-change-me
5353

5454
- name: Deploy to Firebase Hosting
5555
uses: FirebaseExtended/action-hosting-deploy@v0

bs3/src/app/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import geolocatorReducer from './geolocatorSlice';
44

55
export const store = configureStore({
66
reducer: {
7-
app: firestoreReducer,
7+
firestore: firestoreReducer,
88
geolocation: geolocatorReducer,
99
},
1010
});

bs3/src/components/bottom-app-bar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ HideOnScroll.propTypes = {
3535

3636
// Define the types for the Redux state
3737
interface AppState {
38-
app: {
38+
firestore: {
3939
user: string;
4040
};
4141
geolocation: {
@@ -46,7 +46,7 @@ interface AppState {
4646
}
4747

4848
export default function BottomAppBar(): JSX.Element {
49-
const user = useSelector((state: AppState) => state.app.user);
49+
const user = useSelector((state: AppState) => state.firestore.user);
5050
const location = useSelector((state: AppState) => state.geolocation.location);
5151

5252
return (

bs3/src/components/comments-section.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function CommentsSection({ postId }: CommentsSectionProps) {
2525

2626
const textAreaRef = useRef<HTMLTextAreaElement | null>(null);
2727

28-
const userId = useAppSelector(state => state.app.user);
28+
const userId = useAppSelector(state => state.firestore.user);
2929
const location = useAppSelector(state => state.geolocation.location);
3030

3131
useEffect(() => {

bs3/src/components/post-card.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export default function BasicCard({ post, extended = false }: BasicCardProps) {
5757
const [deleteWarningOpen, setDeleteWarningOpen] = useState<boolean>(false);
5858
const [commentsCount, setCommentsCount] = useState<number>(0);
5959

60-
const userId = useAppSelector(state => state.app.user);
60+
const userId = useAppSelector(state => state.firestore.user);
6161
const location = useAppSelector(state => state.geolocation.location);
6262

6363
const [thisPost, setThisPost] = useState<ThisPostState>({

bs3/src/pages/new-post-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export default function PostForm(): JSX.Element {
6161
const navigate = useNavigate();
6262
const dispatch = useAppDispatch();
6363

64-
const userId = useAppSelector((state) => state.app.user);
64+
const userId = useAppSelector((state) => state.firestore.user);
6565
const location = useAppSelector((state) => state.geolocation.location);
6666

6767
const [open, setOpen] = useState<boolean>(!location.local);

bs3/src/pages/post-detail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const idLoader: LoaderFunction = ({ params }: LoaderArgs) => {
2424
function Post(): JSX.Element {
2525
const postId = useLoaderData() as string;
2626
const post = useSelector((state: RootState) =>
27-
state.app.posts.find((item) => item.id === postId)
27+
state.firestore.posts.find((item) => item.id === postId)
2828
);
2929

3030
if (!post) {

bs3/src/pages/post-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ interface SnackBarState {
4545
// PostListPage component
4646
export default function PostListPage(): JSX.Element {
4747
const dispatch = useAppDispatch();
48-
const posts = useAppSelector((state: RootState) => state.app.posts);
48+
const posts = useAppSelector((state: RootState) => state.firestore.posts);
4949
const location = useLocation();
5050
let snackBar: SnackBarState = { open: false, postId: null };
5151

0 commit comments

Comments
 (0)