-
Notifications
You must be signed in to change notification settings - Fork 16
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: fixed critical circular dependencies #549
base: main
Are you sure you want to change the base?
Conversation
Very cool! Thanks! |
Do u have any idea of adding this check to ci-checks in PRs? That should cause an error when number of cyclic dependencies has been increased... |
Preview is ready. |
Added CI check called "Check Circular Dependencies (pull_request) " |
889baa4
to
95a2e88
Compare
8dc445c
to
36e6ca3
Compare
src/toolbar/ToolbarGroup.tsx
Outdated
@@ -5,14 +5,12 @@ import {cn} from '../classname'; | |||
import {ToolbarButton} from './ToolbarButton'; | |||
import {ToolbarButtonPopup} from './ToolbarButtonPopup'; | |||
import {ToolbarListButton} from './ToolbarListButton'; | |||
import {ToolbarBaseProps, ToolbarDataType, ToolbarGroupItemData} from './types'; | |||
import {ToolbarBaseProps, ToolbarDataType, ToolbarGroupData} from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type?
src/toolbar/Toolbar.tsx
Outdated
import {ToolbarButtonGroup, ToolbarGroupData} from './ToolbarGroup'; | ||
import {ToolbarBaseProps} from './types'; | ||
import {ToolbarButtonGroup} from './ToolbarGroup'; | ||
import {ToolbarProps} from './types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type?
I found one unpleasant issue. Currently, when updating to the new version 14.10.2, everything falls apart a bit.
The main problem is that in some cases at runtime i get this error:
Top-level error ReferenceError: Cannot access 'WToolbarTextSelect' before initialization
Such problems can occur due to Circular Dependencies (there's a pretty good description of the problem here: metaplex-foundation/solita#22)
In short, the problem has always been there. You can check it by running
npx dpdm --no-warning --no-tree ./src/index.ts
from root folder of this repo. Right now there is 107 circular dependencies in the projectHere is a circular dependencies that need to be solved:
Here what i did:
Moved Types to a Central Location:
Created a new file
src/bundle/toolbar/types.ts
that now serves as the central location for all toolbar-related typesMoved all toolbar types from
src/toolbar/types.ts
to this new locationMade
src/toolbar/types.ts
re-export everything from the new location (to avoid major release)Separated Heading Configuration:
Created a new file
src/bundle/config/w-heading-config.ts
to separate heading-related configurationsThis helped break up circular dependencies by moving specific toolbar configurations to their own files
Added Circular Dependency Detection:
Added dpdm as a dev dependency in package.json
Added a new npm script
"circular-deps": "dpdm --no-warning --no-tree ./src/index.ts"
to help detect circular dependenciesRight now there is only 99 circular dependencies left :)