Update hank-elements to v3 - #355
Conversation
…ent multiple instances that poll /session/validation
| cookieDomain: hankoConfig.cookieDomain, | ||
| }) | ||
|
|
||
| const hanko = useState( |
There was a problem hiding this comment.
we should probably use nuxtApp.provide('hanko', hankoInstance) (and then nuxtApp.$hanko) rather than useState as state is really meant to be for data that could be passed from server -> client.
There was a problem hiding this comment.
Yes, I agree.
I've changed it to a provide from within the client plugin and added the types there as well.
My second commit is updating the documentation and inner usage of the provided $hanko instead of useHanko()
I kept useHanko alive because of compatibility.
I hope you agree on this.
Thanks for the catch.
There was a problem hiding this comment.
I would rather keep useHanko (and use everywhere instead of nuxtApp.$hanko) but we can return nuxtApp.$hanko inside it.
There was a problem hiding this comment.
Fair enough, I reverted it within the src folder
…or Hanko instance
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #355 +/- ##
===========================================
+ Coverage 36.82% 84.37% +47.54%
===========================================
Files 16 1 -15
Lines 410 32 -378
Branches 25 9 -16
===========================================
- Hits 151 27 -124
+ Misses 245 3 -242
+ Partials 14 2 -12 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Resolved merge conflict, cheers! |
# Conflicts: # package.json # pnpm-lock.yaml
# Conflicts: # README.md # playground/package.json # pnpm-lock.yaml
# Conflicts: # playground/package.json
# Conflicts: # README.md # package.json # playground/package.json # pnpm-lock.yaml # pnpm-workspace.yaml
|
@danielroe , I know you are a busy guy and I hate to bother but.. Hank released to v3 last month, and this package still is on V1. I've bumped this PR branch to V3 and merged all commits from main into it. Or so help me, make me a maintainer.. With love from the Netherlands |
🔗 Linked issue
#3
This change does require a new major version!
❓ Type of change
📖 Documentation (updates to the documentation or readme)
🐞 Bug fix (a non-breaking change that fixes an issue)
[x ] 👌 Enhancement (improving an existing functionality)
📚 Description
Every running instance of Hanko does a session/validate ever so often.
When using useHanko on multiple plugins / middleware / pages, a lot of instances are polling.
We can prevent that by using useState
Hank elements are currenlty on v 2.3.
I've updated the package and places that have changed so the middleware works again