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

Feature/example #20

Merged
merged 10 commits into from
May 4, 2024
Merged

Feature/example #20

merged 10 commits into from
May 4, 2024

Conversation

mdtagg
Copy link
Collaborator

@mdtagg mdtagg commented May 3, 2024

References issue #. Please review this @teammember1, @teamMember2.

Types of changes

  • Bugfix (change which fixes an issue)
  • New feature (change which adds functionality)
  • Refactor (change which changes the codebase without affecting its external behavior)
  • Non-breaking change (fix or feature that would cause existing functionality to work as expected)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Purpose

  • application cards were being deleted through the use of a ref hook
  • this was done to handle an event bubbling problem
  • the delete button is inside of the card component so when delete was pressed the handle click inside of the card component was also called
  • prior to this change there was an if block at the top level of the card onClick function that would check to see if the delete element that was clicked (which was being stored in the del ref) was in the del ref. If it was the onClick function on the card would exit and not run any code.
  • This isnt ideal because there unneeded complexity being added to the app by way of the ref hook and unnecessary execution of functions.

-Also deleting all applications cards functionality was added

Approach

  • I added an event.stopPropagation call in the delete handler to prevent the event from bubbling up to the parent.

  • An extra parameter was added to the deleteApp function called in the application card.

  • This action parameter takes either an empty string or "all" string.

  • One extra line was added to the electron ipcMain "delete app" function that checks for an action.

  • If "all" is true it deletes all the applications on the dashboard.

  • This allows us to delete all example apps when we exit out of our example feature allowing a full seperation of concerns between main app functionality and our example feature

Learning

Screenshot 2024-05-03 at 12 55 05 PM Screenshot 2024-05-03 at 1 00 44 PM

mdtagg added 10 commits May 1, 2024 16:40
Clicking example now populates cards that are not wrapped in
a link component. This allows the app to work the traditional
way and with our example button. useNavigate hook was used in
appplication card component to facilitate. Users can now also
click exit example button to reset all states and use the app
the traditional way.
Inside of application context add app was adjusted to
render multiple cards at once. Each cards data is added
to an object that is iterated over
Applications are now filtered inside of mapping function
Cards are now deleted without the ref hook
I believe the delRef hook was being used to
prevent an issue with event bubbling. Becuase
the delete button is nested inside of the
Card component and card has an onClick the
prior teams were calling the onClick on the
card as well as the delete button.
event.stopPropagation was used to prevent
the bubbling the del ref hook is now able
to be removed
@stephenhyang stephenhyang merged commit b75a750 into dev May 4, 2024
@mdtagg mdtagg deleted the feature/example branch May 15, 2024 22:51
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.

2 participants