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

feat: adding restoreOriginalOnUnmount to useTitle #2563

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

gavinbm
Copy link

@gavinbm gavinbm commented Jun 15, 2024

Description

New option added to the UseTitleOptions interface that will restore the first title passed into useTitle, as requested in issue #2561. I used useMemo to memoize it, I also added one test case to make sure it would pass. One issue that I need help with is determining what to do if both restoreOnUnmount and restoreOriginalOnUnmount are both true at the same time. I'm not sure how that should be handled.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as before)

Checklist

  • Read the Contributing Guide
  • Perform a code self-review
  • Comment the code, particularly in hard-to-understand areas
  • Add documentation
  • Add hook's story at Storybook
  • Cover changes with tests
  • Ensure the test suite passes (yarn test)
  • Provide 100% tests coverage
  • Make sure code lints (yarn lint). Fix it with yarn lint:fix in case of failure.
  • Make sure types are fine (yarn lint:types).

@StructuralRealist
Copy link

Hi @gavinbm,

I agree having both options makes little sense. You either want to restore to the previous, the default or not at all. What about an enum instead of a boolean?

restore: 'previous' | 'default' | 'off' (or null/undefined)

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