Skip to content

Conversation

@busbyk
Copy link
Collaborator

@busbyk busbyk commented Nov 24, 2025

Description

Re-implementing the nuqs-based version of DateRangeFilter + fixes to the "View all" button on the EventList block.

Key Changes

See commit messages.

Future enhancements / Questions

If you don't pass startDate or endDate to the /api/[center]/events endpoint you will now get future events only. In order to get past events you need to pass an endDate. I think this is only a problem if we wanted to get all past and future events since you would need to pass an endDate that includes all future events. But I think that's fine.

…y params in the view all link that are supported by the events page + removing unused params (center and depth aren't supported or needed in getEvents) altogether
… with a modification to the useEffect which determines the matching quick filter -- this sets the current quick filter _and_ associated dates when there is no startDate or endDate passed
@github-actions
Copy link

Preview deployment: https://events-date-range-filter.preview.avy-fx.org

@busbyk busbyk self-assigned this Nov 24, 2025
Copy link
Collaborator

@rchlfryn rchlfryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor thing...I click Events in nav while on it, it should reset the quick date filter. It looks like the events update but we need to update the filter as well.
Kapture 2025-11-24 at 16 43 35

)}
</div>
{eventOptions === 'static' && (
{eventOptions === 'dynamic' && (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we only want to show this for dynamic? It seems like it should be its own setting

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yea that's interesting, we could have a "view all button" group with a label and link field. But the way it is right now, I think it only makes sense to show a view all button for dynamic because we can use the same params from the block in the /events?(params.toString()) url. For static options, where would the link go? We'd need the user to set that.

That could be a cool future enhancement. I'd want to ask current users if they would use that, though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the same logic as for the BlogList block: https://github.com/NWACus/web/blob/events-date-range-filter/src/blocks/BlogList/Component.tsx#L78 (although written differently because of the different way we query)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's keep it as a future enhancement. I was just curious if this was something requested or just randomly decided

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, yea just based on what made sense to me. We only have query params when using the 'dynamic' option and just making the button link to the /events page doesn't feel like it fits the use case of picking specific events.

@busbyk
Copy link
Collaborator Author

busbyk commented Nov 25, 2025

One minor thing...I click Events in nav while on it, it should reset the quick date filter. It looks like the events update but we need to update the filter as well.

Ah yes... that's because, this being a client side navigation, the isInitialMount ref is still true (because the component hasn't been unmounted so we skip the check. I'll try always checking for !startDate && !endDate and see if that would result in any issues. That seems reasonable.

…ext tick + moving no startDate && no endDate check outside of isInitialMount.current if block to handle all client side navigations to /events + matching against quick filters if only startDate is set and falling back to custom in that scenario
@busbyk
Copy link
Collaborator Author

busbyk commented Nov 25, 2025

One minor thing...I click Events in nav while on it, it should reset the quick date filter. It looks like the events update but we need to update the filter as well.

Ah yes... that's because, this being a client side navigation, the isInitialMount ref is still true (because the component hasn't been unmounted so we skip the check. I'll try always checking for !startDate && !endDate and see if that would result in any issues. That seems reasonable.

This was indeed more complicated than I initially realized.

See 42196f0 for updates. What do you think about this approach?

This works for page reloads, navigating to the events page via a Link component from other pages and also from the event page.

https://www.loom.com/share/c9a6d1f67196420180bceb0a7d7f1f46

@busbyk busbyk requested a review from rchlfryn November 25, 2025 20:45
@rchlfryn
Copy link
Collaborator

This looks great!

One minor thing...I click Events in nav while on it, it should reset the quick date filter. It looks like the events update but we need to update the filter as well.

Ah yes... that's because, this being a client side navigation, the isInitialMount ref is still true (because the component hasn't been unmounted so we skip the check. I'll try always checking for !startDate && !endDate and see if that would result in any issues. That seems reasonable.

This was indeed more complicated than I initially realized.

See 42196f0 for updates. What do you think about this approach?

This works for page reloads, navigating to the events page via a Link component from other pages and also from the event page.

This looks great! I think this approach will work.

Copy link
Collaborator

@rchlfryn rchlfryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG - one minor thing


const updateDateSelection = useCallback(
(filter: string, start: string, end: string) => {
console.log(`Setting filter to ${filter} and startDate: ${start} and endDate: ${end}.`)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log(`Setting filter to ${filter} and startDate: ${start} and endDate: ${end}.`)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah a classic "forgot to remove my debug logs 🤦 " haha. Thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh hilarious - I'd already removed it and forgot to push. Even more classic 😏

@busbyk busbyk merged commit 4f199c7 into events Nov 26, 2025
1 of 2 checks passed
@busbyk busbyk deleted the events-date-range-filter branch November 26, 2025 23:22
@rchlfryn rchlfryn mentioned this pull request Nov 30, 2025
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.

3 participants