Skip to content

Feat: toy task#3

Open
soixdev91 wants to merge 13 commits intomasterfrom
feat/toy-task
Open

Feat: toy task#3
soixdev91 wants to merge 13 commits intomasterfrom
feat/toy-task

Conversation

@soixdev91
Copy link
Owner

No description provided.

@soixdev91 soixdev91 requested a review from Hantex9 October 17, 2025 15:01
Copy link
Collaborator

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

Good job, Pawel!
Just a few small improvements and considerations, you're on the right track

Copy link
Collaborator

Choose a reason for hiding this comment

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

Be careful, this file should never be modified. Make sure your environment is clean before starting the iOS build.

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with ef2d827

export const ProfileFields = () => {
const toyProfilePot = useIOSelector(toyProfileSelector);

const profile = pot.isSome(toyProfilePot) ? toyProfilePot.value : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can consider using the .toUndefined() method of the pot, which automatically returns the pot value if it exists, or undefined otherwise.

Suggested change
const profile = pot.isSome(toyProfilePot) ? toyProfilePot.value : undefined;
const profile = pot.toUndefined(toyProfilePot);

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67

Comment on lines +34 to +36
if (!profile) {
return <LoadingSpinner />;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if there's an error in the API request and we don't have the profile?
In this case, the app shows an infinite loading spinner without providing the user with proper feedback.

Consider using the pot.fold method to map each case to the correct output screen.
For example:

  • If the pot is in an error state, show an error screen (using OperationResultScreenContent).
  • If it's loading, display a loading spinner.
  • And so on for the other possible states.

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67


return (
<LoadingSpinnerOverlay
isLoading={pot.isNone(toyProfilePot) || pot.isLoading(toyProfilePot)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67

Comment on lines +17 to +24
navigation: IOStackNavigationProp<
ToyProfileParamsList,
"PROFILE_CONFIRM_DELETE"
>;
};

export const ProfileConfirmDeleteScreen = ({ navigation }: Props) => {
const dispatch = useDispatch();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of using the navigation component prop, consider using the useIONavigation hook directly.
This way, you don’t need to add any extra boilerplate about the navigation typing, you can simply do inside the component:

const navigation = useIONavigation();

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 53a1693

Comment on lines +23 to +25
const ProfileHomeScreen = ({ navigation }: Props) => {
const dispatch = useDispatch();

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 53a1693

Comment on lines +37 to +40
const delStatus = pot.isSome(deletePot) ? deletePot.value?.status : undefined;
const delDisabled =
pot.isLoading(deletePot) || pot.isNone(deletePot) || !!delStatus;
const delValue =
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider renaming the variables to make them more self-explanatory.

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with df1949a

Copy link
Collaborator

Choose a reason for hiding this comment

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

In this case since the file contains both the handlers and the watcher, consider renaming the file to index.ts

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think, just to follow our conventions, it will be better to separate this into two different files:

  • in index we can keep the watchToyProfileSaga
  • in another file the loadToyProfileSaga and I think it will be better renamed it handleLoadToyProfileSaga

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 5052347

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 5052347

This reverts commit e5648f0.
Copy link
Owner Author

@soixdev91 soixdev91 left a comment

Choose a reason for hiding this comment

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

updated with requested changes

Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 5052347

export const ProfileFields = () => {
const toyProfilePot = useIOSelector(toyProfileSelector);

const profile = pot.isSome(toyProfilePot) ? toyProfilePot.value : undefined;
Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67

Comment on lines +34 to +36
if (!profile) {
return <LoadingSpinner />;
}
Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67


return (
<LoadingSpinnerOverlay
isLoading={pot.isNone(toyProfilePot) || pot.isLoading(toyProfilePot)}
Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 86fcc67

Comment on lines +17 to +24
navigation: IOStackNavigationProp<
ToyProfileParamsList,
"PROFILE_CONFIRM_DELETE"
>;
};

export const ProfileConfirmDeleteScreen = ({ navigation }: Props) => {
const dispatch = useDispatch();
Copy link
Owner Author

Choose a reason for hiding this comment

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

solved with 53a1693

Copy link
Collaborator

@Hantex9 Hantex9 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Collaborator

@LeleDallas LeleDallas left a comment

Choose a reason for hiding this comment

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

Good job! 💫

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.

3 participants