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 data fetching to use browser timezone, remove server rendering #110

Merged
merged 12 commits into from
Nov 15, 2024

Conversation

benvinegar
Copy link
Owner

Fixes #109 and #107

This is a major change that removes all server-side rendered React, so that the app can first inspect the user's browser timezone, and pass that along to every component.

By doing so, we avoid having to use Cloudflare Worker's cf.timezone property, which can create confusing scenarios (like #107) when the user's internet doesn't route through the timezone they're located in (e.g. when using a VPN or proxy).

Copy link

codecov bot commented Nov 14, 2024

Codecov Report

Attention: Patch coverage is 72.05882% with 95 lines in your changes missing coverage. Please review.

Project coverage is 77.66%. Comparing base (56518f8) to head (870bc1a).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
app/lib/utils.ts 41.53% 38 Missing ⚠️
app/routes/resources.timeseries.tsx 67.32% 33 Missing ⚠️
app/routes/resources.stats.tsx 83.14% 15 Missing ⚠️
app/components/TimeSeriesChart.tsx 18.18% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #110      +/-   ##
==========================================
- Coverage   80.26%   77.66%   -2.61%     
==========================================
  Files          29       31       +2     
  Lines        2954     3138     +184     
  Branches      201      217      +16     
==========================================
+ Hits         2371     2437      +66     
- Misses        575      693     +118     
  Partials        8        8              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@benvinegar benvinegar changed the title Refactor data fetching to use browser timezone, remove server rendering [WIP] Refactor data fetching to use browser timezone, remove server rendering Nov 14, 2024
@benvinegar benvinegar merged commit 0a19c38 into main Nov 15, 2024
3 checks passed
@benvinegar benvinegar deleted the refactor-tz branch November 15, 2024 20:59
benvinegar added a commit that referenced this pull request Dec 20, 2024
…ng (#110)

* Begin refactoring date/interval code into utils.ts

* Time series chart renders

* Add timezone to time series chart

* Sites ordered by hits doesnt need tz

* Update resources.country to use client tz

* Cards all pass timezone

* Fix errant cf timezone in resources.paths.tsx

* Reload timeseries chart on interval change

* Refactor stats into its own card, remove all uses of cf timezone

* Fix tests

* Fix lint errors

* Fix "unknown" site id issue
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.

Use timezone from browser instead of cloudflare.cf.timezone
1 participant