-
Notifications
You must be signed in to change notification settings - Fork 220
feat(graphiql): add data fetching hooks #6583
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
base: 11-06-feat_graphiql_add_graphiql_editor_with_monaco_integration
Are you sure you want to change the base?
feat(graphiql): add data fetching hooks #6583
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Coverage report
Show new covered files 🐣
Test suite run success3437 tests passing in 1399 suites. Report generated by 🧪jest coverage report action from eeb9b92 |
f1c8933 to
b9ab875
Compare
3b8bbcc to
2e1b3ee
Compare
b9ab875 to
5b82f74
Compare
2e1b3ee to
8ade16e
Compare
5b82f74 to
37969e0
Compare
37969e0 to
dbe1b3f
Compare
8ade16e to
70c73e5
Compare
70c73e5 to
a6fca5f
Compare
dbe1b3f to
3e5ff33
Compare
a6fca5f to
f6b80c1
Compare
3e5ff33 to
7479a72
Compare
f6b80c1 to
f574269
Compare
ba4433a to
34f9d5e
Compare
f574269 to
1e4b9d5
Compare
34f9d5e to
4ff7e34
Compare
33e19e2 to
fa9758f
Compare
4ff7e34 to
9cccb15
Compare
Adds custom React hooks for server status polling and data fetching. - Add usePolling hook for generic interval-based polling - Add useServerStatus hook for checking server health - Include comprehensive tests (386 lines) All hook tests pass
9cccb15 to
fbbce5d
Compare
fa9758f to
eeb9b92
Compare
|
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. |

WHY are these changes introduced?
This PR adds custom React hooks for server health monitoring and data fetching. This is the sixth PR in the 8-PR migration stack.
Context: The current template-based GraphiQL implementation uses vanilla JavaScript with
setIntervalto poll the server for health status and app installation state. By creating reusable React hooks, we can:WHAT is this pull request doing?
This PR adds two custom hooks that replace vanilla JavaScript polling with React-based data fetching.
Key Changes:
1. usePolling Hook (
src/hooks/usePolling.ts):A generic hook for interval-based polling with proper cleanup and error handling.
Features:
useRefto avoid stale closure issuesUsage:
2. useServerStatus Hook (
src/hooks/useServerStatus.ts):Monitors server health and app installation status by polling two endpoints.
Two Polling Mechanisms:
Ping Polling (
/graphiql/ping- every 2 seconds by default):serverIsLivestateStatus Polling (
/graphiql/status- every 5 seconds by default):storeFqdn,appName,appUrl)appIsInstalledstate and store infoReturn Value:
Usage:
Error Handling:
Replaces:
setIntervalpolling logicTesting:
Files Added:
src/hooks/usePolling.ts- Generic polling hook (46 lines)src/hooks/usePolling.test.ts- Tests (176 lines)src/hooks/useServerStatus.ts- Server status hook (102 lines)src/hooks/useServerStatus.test.ts- Tests (210 lines)src/hooks/index.ts- Barrel exportsDependencies
Builds on:
Used by:
ServerStatustype)How to test your changes?
Manual Testing:
You can test the hooks in the App component:
Measuring impact
Checklist