-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
fix circular imports, add test script for circular imports #1450
Conversation
houdini-svelte/src/plugin/kit.ts -> index.ts (not caught by madge) houdini-svelte/src/plugin/kit.ts -> houdini-svelte/src/plugin/extract.ts houdini-svelte/src/plugin/kit.ts -> houdini-svelte/src/plugin/extractLoadFunction.ts
houdini-svelte/src/plugin/index.ts > houdini-svelte/src/plugin/fsPatch.ts
houdini-svelte/src/plugin/kit.ts -> houdini-svelte/src/plugin/extractLoadFunction.ts
houdini/src/lib/index.ts -> houdini/src/lib/detectTools.ts houdini/src/lib/index.ts -> houdini/src/lib/typescript.ts houdini/src/codegen/generators/runtime/index.ts -> houdini/src/lib/pluginRuntime.ts
houdini/src/lib/index.ts -> houdini/src/lib/router/server.ts houdini/src/lib/index.ts -> houdini/src/lib/router/manifest.ts houdini/src/lib/index.ts -> houdini/src/lib/router/conventions.ts
houdini-react/src/plugin/index.ts -> houdini-react/src/plugin/vite.tsx houdini-react/src/runtime/routing/Router.tsx -> houdini-react/src/runtime/hooks/useDocumentHandle.ts houdini-react/src/runtime/hooks/useDocumentStore.ts -> index -> houdini-react/src/runtime/routing/Router.tsx
🦋 Changeset detectedLatest commit: b57412e The changes in this PR will be included in the next version bump. This PR includes changesets to release 8 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for houdini-docs-next canceled.
|
✅ Deploy Preview for houdinigraphql canceled.
|
Thanks so much for digging into this! I appreciate the work |
Sorry about the formatting issues, I was totally unaware of the checks. Submitted a PR to remind other new contributors to check as well! |
Oh no problem. Thanks for taking care of them |
Best practice. Related: #1304 (see comment below)
This PR fixes several circular dependencies that surfaced when testing, and a few that I found manually. The majority were caused by calling
import {obj} from './index'
from within files that were exported by that sameindex
.`madge --circular` (ignoring circular type imports):
Since the erratic [1] nature of circular dependencies throws Vite HMR [2] and other quite hard-to-debug errors with cryptic [3] messages, IMHO it is best practice to fix them, even if the issue rarely comes up on large projects (as raised in #1304 (comment))
(note that this erratic nature means I cannot confirm yet if its fixed!). EDIT: it does make vite HMR subjectively more stable, but is otherwise unrelated to my comment.As the 'adding tests' section prescribes, I have added the
pnpm check-circular-deps
command on the root, requiring and configuringmadge
, for the task. It should probable be wise to run this on the Github Actions workflow on PRs, to prevent future issues.To help everyone out, please make sure your PR does the following:
pnpm check-circular-deps
pnpm run tests
andcd integration && pnpm run tests
-> please note that master currently has 2 failed tests @(that was an issue on my part)packages/houdini-react/src/plugin/codegen/entries/entries.test.ts
pnpm changeset