Skip to content

Remove QueriesRepository.ts layer - #857

Merged
AdityaHegde merged 18 commits into
svelte-queryfrom
svelte-query-explicit
Aug 31, 2022
Merged

AdityaHegde merged 18 commits into
svelte-queryfrom
svelte-query-explicit

Conversation

@ericpgreen2

@ericpgreen2 ericpgreen2 commented Aug 31, 2022 •

Copy link
Copy Markdown
Contributor

This PR:

  • Removes the QueriesRepository.ts layer from our svelte-query custom hooks. Instead of routing first requests to useQuery and subsequent requests to [query].setOptions, we call useQuery every time. We think it's idempotent.
  • Adds 30 second caching for the data queries (timeseries, toplist, totals)

Either @hamilton or @AdityaHegde can review.

ericpgreen2 and others added 8 commits August 30, 2022 22:23
* Adding optional query profile emitting

* Addressing PR comments
Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>
* adds calendar icon; fixes spacing in dashboard header

* tightens up dashboard header

* re-instates spacing for dashboard CTA

Co-authored-by: Marissa Gorlick <magorlick@gmail.com>
@AdityaHegde
AdityaHegde merged commit 99a23d1 into svelte-query Aug 31, 2022
@AdityaHegde
AdityaHegde deleted the svelte-query-explicit branch August 31, 2022 16:44
hamilton added a commit that referenced this pull request Aug 31, 2022
* Adding svelte-query

* Adding reactive query update

* Adding backend APIs based on new specs

* Removing dev routes

* Renaming

* Fix endpoint paths

* Adding validation to /meta endpoint

* Renaming and fixing sqlName

* Renaming filter

* Query the `/meta` API via `svelte-query` (#801)

* Create `lib/svelte-query/queries` directory

* Add `svelte-query` `QueryClient`

* Bugfix

* Call `/meta` via `svelte-query` (WIP)

* Change query key format

* Refactor `LeaderboardDisplay` to use `/meta` API

* Avoid "missing queryFn" error log

* Use vanilla fetch

* Remove log

* Use `/meta` for list of measures

* Update `esbuild`

* Use new type name

* Remove client-side validation (tmp bugfix)

* Call `svelte-query` for valid measures and dimensions

* Add `TODO` for OpenAPI client code generation

* Update comment

* Query the `/timeseries` API via `svelte-query` (#803)

* Create `lib/svelte-query/queries` directory

* Add `svelte-query` `QueryClient`

* Bugfix

* Add query key and function for `/timeseries` API

* Call `/meta` via `svelte-query` (WIP)

* Change query key format

* Refactor `LeaderboardDisplay` to use `/meta` API

* Avoid "missing queryFn" error log

* Use vanilla fetch

* Remove log

* Remove unused code

* Use `/meta` for list of measures

* Update `esbuild`

* Add  query to `timeseries` endpoint

* Call `timeseries` endpoint via `svelte-query`

* Use new type name

* Remove client-side validation (tmp bugfix)

* Call `svelte-query` for valid measures and dimensions

* Add `TODO` for OpenAPI client code generation

* Update comment

* Use updated type names

* Clean up

* Invalidate `/timeseries` query when time controls change

* updating og:image (#760)

* Revert "Merge branch 'main' into svelte-query-timeseries"

This reverts commit 2b68e54, reversing
changes made to a13c8d6.

Co-authored-by: Mike Godwin <1851282+godzig@users.noreply.github.com>
Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Adding svelte-query to leaderboards (#806)

* Move time range logic from Redux to components (WIP)

* Moving big number to svelte-query (#817)

* Moving big number to svelte-query

* Adding timeseries to invalidation

* Use a Svelte store for the metrics explorer (#820)

* Moving to svelte store for explorer

* Changing the svelte store usage pattern

* Fixing a few issues

* Updating names

* Merge `main` into `svelte-query`

* Update package.json

* Update `package-lock.json`

* Revert regressions in docs

* Move function into the file it's used in

* Fix lint errors

* Fix linechart jank (#823)

* Moving to svelte store for explorer

* Add guard to prevent re-renders

* Ensure we only make valid time ranges

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Remove old Redux code (#825)

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Remove explore redux (#826)

* Removing remaining explore redux code

* Fix import

* Removing unnecessary fields from explore

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Fix API bugs and tests (#836)

* Fixing API bugs and tests

* Remove TODO

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Bugfix

* Create concise custom query hooks (#829)

* Removing remaining explore redux code

* Fix import

* Use `metricView` terminology

* Refactor `svelte-query` call to `/meta`

* Refactor `svelte-query` call to `/timeseries`

* Refactor `svelte-query` call to `/toplist`

* Refactor `svelte-query` call to `/totals`

* Ensure queries don't run with undefined parameters

* Mini refactor

* Add request parameters to query keys (recommended in docs)

* Fix error message

* Fix animation bug

* Avoid error when `metricsExplorer` is undefined

* Ensure `offset == 0` doesn't disable the query

* Various fixes

* Fixing a few issues with reactivity

* Remove buggy animation

* Handling case where dimension is deleted

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Fix time controls state when switching dashboards

* Fix lint

* Fix time control state (take 2)

* Add `TODO`

* Refine the loading animation for leaderboards (#848)

* refines the loading animation for leaderboards

* replaces data only after fetch is complete

* Gray the leaderboard numbers during loading

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Fix key for self-managed query cache

* Restore types to custom query hooks

* Fixing null totals values

* Fixing reactive statement for reference values

* Fixing null values not being marked as active

* Fixing humanise values

* Fixing reference value being undefined during query

* Fixing reference value being undefined during query

* Fixing build

* Use `refetchOnMount: true` globally

* Remove `QueriesRepository.ts` layer (#857)

* Use explicit `svelte-query` for leaderboards

* refactors back toward basic svelte query usage

* renames the top list query to useTopListQuery

* Better naming

* Refactor `useTotalsQuery`

* updates Totals query; removes unneeded usage of invalidateMetricViewData

* Remove `queriesRepository` layer from `useMetaQuery`

* Set better `refetchOnX` values

* Remove `queriesRepository` layer from `useTimeSeriesQuery`

* Remove `QueriesRepository.ts`

* Set `refetchOnReconnect` and `refetchOnWindowFocus` back to `true`

* Fix `WHERE` clause generation

* Adding optional query profile emitting (#819)

* Adding optional query profile emitting

* Addressing PR comments

* Fixing quick metrics modal missing buttons (#859)

* enables negative timeseries (#850)

Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>

* adds calendar icon; fixes spacing in dashboard header (#856)

* adds calendar icon; fixes spacing in dashboard header

* tightens up dashboard header

* re-instates spacing for dashboard CTA

Co-authored-by: Marissa Gorlick <magorlick@gmail.com>

* Fixing edge cases with modifying models

Co-authored-by: Hamilton Ulmer <hamilton.ulmer@gmail.com>
Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>
Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>
Co-authored-by: Marissa Gorlick <magorlick@gmail.com>

* Fix bug where measure edits aren't reflected in Explore

* Fix lint

* Invalidate `/meta` when deleting measures and dimensions

* Remove unused props

* Remove unused prop

* Use previous time controls when switching from a source/model to an existing dashboard

Co-authored-by: greenep12 <ericpgreen2@gmail.com>
Co-authored-by: Mike Godwin <1851282+godzig@users.noreply.github.com>
Co-authored-by: Hamilton Ulmer <hamilton.ulmer@gmail.com>
Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>
Co-authored-by: Marissa Gorlick <magorlick@gmail.com>
djbarnwal added a commit that referenced this pull request Aug 3, 2023
* Adding svelte-query

* Adding reactive query update

* Adding backend APIs based on new specs

* Removing dev routes

* Renaming

* Fix endpoint paths

* Adding validation to /meta endpoint

* Renaming and fixing sqlName

* Renaming filter

* Query the `/meta` API via `svelte-query` (#801)

* Create `lib/svelte-query/queries` directory

* Add `svelte-query` `QueryClient`

* Bugfix

* Call `/meta` via `svelte-query` (WIP)

* Change query key format

* Refactor `LeaderboardDisplay` to use `/meta` API

* Avoid "missing queryFn" error log

* Use vanilla fetch

* Remove log

* Use `/meta` for list of measures

* Update `esbuild`

* Use new type name

* Remove client-side validation (tmp bugfix)

* Call `svelte-query` for valid measures and dimensions

* Add `TODO` for OpenAPI client code generation

* Update comment

* Query the `/timeseries` API via `svelte-query` (#803)

* Create `lib/svelte-query/queries` directory

* Add `svelte-query` `QueryClient`

* Bugfix

* Add query key and function for `/timeseries` API

* Call `/meta` via `svelte-query` (WIP)

* Change query key format

* Refactor `LeaderboardDisplay` to use `/meta` API

* Avoid "missing queryFn" error log

* Use vanilla fetch

* Remove log

* Remove unused code

* Use `/meta` for list of measures

* Update `esbuild`

* Add  query to `timeseries` endpoint

* Call `timeseries` endpoint via `svelte-query`

* Use new type name

* Remove client-side validation (tmp bugfix)

* Call `svelte-query` for valid measures and dimensions

* Add `TODO` for OpenAPI client code generation

* Update comment

* Use updated type names

* Clean up

* Invalidate `/timeseries` query when time controls change

* updating og:image (#760)

* Revert "Merge branch 'main' into svelte-query-timeseries"

This reverts commit 2b68e54, reversing
changes made to a13c8d6.

Co-authored-by: Mike Godwin <1851282+godzig@users.noreply.github.com>
Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Adding svelte-query to leaderboards (#806)

* Move time range logic from Redux to components (WIP)

* Moving big number to svelte-query (#817)

* Moving big number to svelte-query

* Adding timeseries to invalidation

* Use a Svelte store for the metrics explorer (#820)

* Moving to svelte store for explorer

* Changing the svelte store usage pattern

* Fixing a few issues

* Updating names

* Merge `main` into `svelte-query`

* Update package.json

* Update `package-lock.json`

* Revert regressions in docs

* Move function into the file it's used in

* Fix lint errors

* Fix linechart jank (#823)

* Moving to svelte store for explorer

* Add guard to prevent re-renders

* Ensure we only make valid time ranges

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Remove old Redux code (#825)

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Remove explore redux (#826)

* Removing remaining explore redux code

* Fix import

* Removing unnecessary fields from explore

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Fix API bugs and tests (#836)

* Fixing API bugs and tests

* Remove TODO

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Bugfix

* Create concise custom query hooks (#829)

* Removing remaining explore redux code

* Fix import

* Use `metricView` terminology

* Refactor `svelte-query` call to `/meta`

* Refactor `svelte-query` call to `/timeseries`

* Refactor `svelte-query` call to `/toplist`

* Refactor `svelte-query` call to `/totals`

* Ensure queries don't run with undefined parameters

* Mini refactor

* Add request parameters to query keys (recommended in docs)

* Fix error message

* Fix animation bug

* Avoid error when `metricsExplorer` is undefined

* Ensure `offset == 0` doesn't disable the query

* Various fixes

* Fixing a few issues with reactivity

* Remove buggy animation

* Handling case where dimension is deleted

Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>

* Fix time controls state when switching dashboards

* Fix lint

* Fix time control state (take 2)

* Add `TODO`

* Refine the loading animation for leaderboards (#848)

* refines the loading animation for leaderboards

* replaces data only after fetch is complete

* Gray the leaderboard numbers during loading

Co-authored-by: greenep12 <ericpgreen2@gmail.com>

* Fix key for self-managed query cache

* Restore types to custom query hooks

* Fixing null totals values

* Fixing reactive statement for reference values

* Fixing null values not being marked as active

* Fixing humanise values

* Fixing reference value being undefined during query

* Fixing reference value being undefined during query

* Fixing build

* Use `refetchOnMount: true` globally

* Remove `QueriesRepository.ts` layer (#857)

* Use explicit `svelte-query` for leaderboards

* refactors back toward basic svelte query usage

* renames the top list query to useTopListQuery

* Better naming

* Refactor `useTotalsQuery`

* updates Totals query; removes unneeded usage of invalidateMetricViewData

* Remove `queriesRepository` layer from `useMetaQuery`

* Set better `refetchOnX` values

* Remove `queriesRepository` layer from `useTimeSeriesQuery`

* Remove `QueriesRepository.ts`

* Set `refetchOnReconnect` and `refetchOnWindowFocus` back to `true`

* Fix `WHERE` clause generation

* Adding optional query profile emitting (#819)

* Adding optional query profile emitting

* Addressing PR comments

* Fixing quick metrics modal missing buttons (#859)

* enables negative timeseries (#850)

Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>

* adds calendar icon; fixes spacing in dashboard header (#856)

* adds calendar icon; fixes spacing in dashboard header

* tightens up dashboard header

* re-instates spacing for dashboard CTA

Co-authored-by: Marissa Gorlick <magorlick@gmail.com>

* Fixing edge cases with modifying models

Co-authored-by: Hamilton Ulmer <hamilton.ulmer@gmail.com>
Co-authored-by: Aditya Hegde <adityahegderocks@gmail.com>
Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>
Co-authored-by: Marissa Gorlick <magorlick@gmail.com>

* Fix bug where measure edits aren't reflected in Explore

* Fix lint

* Invalidate `/meta` when deleting measures and dimensions

* Remove unused props

* Remove unused prop

* Use previous time controls when switching from a source/model to an existing dashboard

Co-authored-by: greenep12 <ericpgreen2@gmail.com>
Co-authored-by: Mike Godwin <1851282+godzig@users.noreply.github.com>
Co-authored-by: Hamilton Ulmer <hamilton.ulmer@gmail.com>
Co-authored-by: Dhiraj Barnwal <sumankumaribarnwal@gmail.com>
Co-authored-by: Marissa Gorlick <magorlick@gmail.com>
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