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

Refactor Notification Handling and Rename Firebase Service Worker Scope #497

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

gkatrakazas
Copy link
Member

@gkatrakazas gkatrakazas commented Jan 21, 2025

This PR introduces several enhancements and refactors to streamline notification handling and improve code clarity. The changes are as follows:

Renaming for Clarity

  • Renamed HandlerNotification to NewCredentialNotification for better alignment with its purpose.

Enhanced Notification Listening

  • Extracted listenForNotifications logic into a higher-order hook for improved reusability and modularity, and rename it to useNewCredentialListener.
  • Updated useNewCredentialListener to use a ref for the getData function, preventing unnecessary re-renders and ensuring consistent behavior.

Improved Service Worker Scope (Related with: #77)

  • Renamed the Firebase service worker scope to align with updated functionality and improve maintainability.

Persistent Notification Handling

  • Introduced the use of sessionStorage to temporarily store notifications, ensuring they are displayed even after a page reload or redirection.

Fixes and Refinements

  • Resolved an issue to ensure continuous listening for notifications without requiring a page reload.
  • Refactored service worker background notification click handling to improve maintainability and functionality.

Benefits

  • Improved Code Clarity: Renaming components and hooks for more descriptive and intuitive usage.
  • Better User Experience: Persistent notifications prevent loss of critical updates during page reloads or navigation.
  • Enhanced Maintainability: Refactored hooks and service worker logic simplify future updates and debugging.

@gkatrakazas gkatrakazas requested a review from kkmanos January 21, 2025 09:59
@gkatrakazas gkatrakazas marked this pull request as ready for review January 21, 2025 09:59
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.

Inconsistent Firebase Notifications for New Credentials with 'Remember Issuer'
2 participants