-
Notifications
You must be signed in to change notification settings - Fork 35
refactor(webapp): move version history and diagram loading to TanStack Query #821
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
Merged
Merged
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
695706b
feat(webapp): adopt TanStack Query as the HTTP data layer
FelixTJDietrich b83522b
refactor(webapp): resolve version adapters by kind from route context
FelixTJDietrich 449eb33
fix(webapp): resolve the undo toast's backend outside the provider
FelixTJDietrich 0ddaeb6
fix(webapp): exit preview on peer delete; replace the legal resolver …
FelixTJDietrich aed1828
fix(webapp): key the thumbnail SVG cache by backend kind
FelixTJDietrich 500482b
refactor(webapp): drop the redundant importDiagram cast in the thumbnail
FelixTJDietrich a4af6b9
docs(webapp): add changeset for the TanStack Query migration
FelixTJDietrich ad6ca4a
Merge origin/main into the TanStack Query migration
FelixTJDietrich edd71ee
fix(webapp): keep the headRev handoff alive when the version panel cl…
FelixTJDietrich a2ab404
refactor(webapp): make the Query devtools opt-in instead of always on
FelixTJDietrich fd892b3
docs(webapp): document the Query devtools flag in the README
FelixTJDietrich 1cddd68
fix(webapp): stop the version list refetching for users who never ope…
FelixTJDietrich 4840de7
refactor(webapp): make the editor seed a plain fetch, and cover peer …
FelixTJDietrich 495c5a5
fix(webapp): reconcile a cross-tab delete of the previewed version
FelixTJDietrich File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@tumaet/webapp": patch | ||
| --- | ||
|
|
||
| No visible change to the editor. Under the hood, the web app now loads and caches version history, version snapshots, and shared diagrams through one shared data layer instead of hand-written fetching, so the version panel refreshes and reconciles more consistently across tabs and collaborators. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,14 +1,42 @@ | ||
| import React, { ReactNode } from "react" | ||
| import { QueryClientProvider } from "@tanstack/react-query" | ||
| import { ReactQueryDevtools } from "@tanstack/react-query-devtools" | ||
| import { EditorProvider, ModalProvider } from "@/contexts" | ||
| import { queryClient } from "@/queryClient" | ||
|
|
||
| interface Props { | ||
| children: ReactNode | ||
| } | ||
|
|
||
| /** | ||
| * Query Devtools are opt-in: they float a toggle button over the editor's own | ||
| * floating chrome, which is in the way far more often than it is useful. Turn | ||
| * them on per browser with | ||
| * | ||
| * localStorage.setItem("apollon:query-devtools", "1") | ||
| * | ||
| * and reload. Read once at module load — the flag is a debugging switch, not | ||
| * reactive state. Production is unaffected either way: the package swaps | ||
| * itself for a no-op export when `NODE_ENV !== "development"`. | ||
| */ | ||
| const SHOW_QUERY_DEVTOOLS = | ||
| import.meta.env.DEV && | ||
| (() => { | ||
| try { | ||
| return localStorage.getItem("apollon:query-devtools") === "1" | ||
| } catch { | ||
| // Storage throws when cookies / site data are blocked. | ||
| return false | ||
| } | ||
| })() | ||
|
|
||
| export const AppProviders: React.FC<Props> = ({ children }) => { | ||
| return ( | ||
| <EditorProvider> | ||
| <ModalProvider>{children}</ModalProvider> | ||
| </EditorProvider> | ||
| <QueryClientProvider client={queryClient}> | ||
| <EditorProvider> | ||
| <ModalProvider>{children}</ModalProvider> | ||
| </EditorProvider> | ||
| {SHOW_QUERY_DEVTOOLS && <ReactQueryDevtools initialIsOpen={false} />} | ||
| </QueryClientProvider> | ||
| ) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.