Skip to content

fix(cli): rename libs to initializers, always use init as func#364

Merged
alvrs merged 5 commits into
latticexyz:mainfrom
dk1a:dk1a/doc-deploy-libs
Feb 3, 2023
Merged

fix(cli): rename libs to initializers, always use init as func#364
alvrs merged 5 commits into
latticexyz:mainfrom
dk1a:dk1a/doc-deploy-libs

Conversation

@dk1a

@dk1a dk1a commented Feb 2, 2023

Copy link
Copy Markdown
Contributor

For #361

@dk1a dk1a requested a review from alvrs as a code owner February 2, 2023 19:43
Comment thread guides/getting_started.md Outdated
Comment thread guides/getting_started.md Outdated
@dk1a dk1a force-pushed the dk1a/doc-deploy-libs branch from 7b30e6b to 11ac3d3 Compare February 2, 2023 20:03
@dk1a

dk1a commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author

I like initializers, changed it up, and with the new name it seems self-descriptive too

@dk1a dk1a changed the title docs: libs in deploy.json fix: rename libs to initializers in deploy.json Feb 2, 2023
@dk1a dk1a changed the title fix: rename libs to initializers in deploy.json fix(cli): rename libs to initializers, always use init as func Feb 2, 2023
frolic
frolic previously approved these changes Feb 2, 2023

@frolic frolic left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏 Looks great, thank you!

My only other curiosity now is in terms of mud dev and "hot reloading" of contracts, when do initializers run? Once only on initial world deploy? On every change to the initializer lib?

@dk1a

dk1a commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author

My only other curiosity now is in terms of mud dev and "hot reloading" of contracts, when do initializers run? Once only on initial world deploy? On every change to the initializer lib?

Good point, I use hsr too rarely to have thought of this. I made initializers respect the init flag, but it's kinda useless, especially for hot reloading. I think I should move inits from deploySystems into deploy and use _reuseComponents, so initializers run only if components are redeployed

@frolic

frolic commented Feb 2, 2023

Copy link
Copy Markdown
Member

cc @alvrs for input

@dk1a

dk1a commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author

Oh, and to be more specific, hsr always reuses components afaik, so deploy-contracts --watch will ignore any changes to components and initializers, and only update the system code

@dk1a

dk1a commented Feb 2, 2023

Copy link
Copy Markdown
Contributor Author

Oh, and to be more specific, hsr always reuses components afaik, so deploy-contracts --watch will ignore any changes to components and initializers, and only update the system code

After some testing turns out deploy-contracts --watch always had reuseComponents: false, which means it just didn't work? Since components can never be redeployed (#286).
I fixed it and everything seems to work as I expect and think it should (as in, deploy-contracts --watch deploys everything and runs initializers once, and on any change only redeploys the systems).

@alvrs I may be missing something, check out the changes to see if they make sense and the bug really existed

Comment thread guides/getting_started.md Outdated
@alvrs

alvrs commented Feb 2, 2023

Copy link
Copy Markdown
Member

After some testing turns out deploy-contracts --watch always had reuseComponents: false, which means it just didn't work?

Good catch! Previously we set reuseComponents to true when specific systems were provided, but this was recently changed in #356 and the implications for HMR missed. Thanks for fixing!

Co-authored-by: alvarius <89248902+alvrs@users.noreply.github.com>
@alvrs alvrs merged commit 6fde644 into latticexyz:main Feb 3, 2023
@dk1a dk1a deleted the dk1a/doc-deploy-libs branch February 5, 2023 10:28
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