shishkin / astro-pagefind

Astro integration for Pagefind static site search.
MIT License
266 stars 15 forks source link

fix: event listener to work with page-load #57

Closed joshmedeski closed 10 months ago

joshmedeski commented 1 year ago

Fixes #55

Changes the event listener from DOMContentLoaded to astro:page-load to support Astro's View Transitions feature.

Note: I'm not sure when this event got added to Astro so we'll want to test and possibly update the readme to state what version of Astro is supported.

joshmedeski commented 10 months ago

@shishkin are you interested in merging this?

shishkin commented 10 months ago

Hi @joshmedeski. Thanks for the PR and sorry for a delay. I'm definitely interested in getting it merged, but unfortunately I just don't seem to get view transitions to assess the implications.

Maybe you can answer my concerns which I could not figure out by reading Astro docs:

  1. Does astro:page-load event get fired when view transitions are not in use? If not, how to handle normal transitions and view transitions at the same time?
  2. Does it break compatibility with Astro 2.0? If yes, it would require a major version bump.
shishkin commented 10 months ago

I've added support for view transitions in 6feefb904eea5c600c0b6f788087e72e6689c606, released in 1.4.0. It turned out that astro:page-load event is not fired without ViewTransitions router.

joshmedeski commented 10 months ago

Hey, I've been focused on other things this week, thanks for getting it done! 🎉