-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
feat: Hot Reloading #7489
feat: Hot Reloading #7489
Conversation
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.
Looks good!
I gave it a try on:
- Firefox, Chrome, and Safari on macOS (with nginx)
- Firefox, Chrome, and Edge on Windows (with Apache)
Besides some general comments on the code, I noticed some visual issues when hot reloading is enabled:
hot-reload-visual-issue.mp4
Please take a look at the vertical scroll bar on the toolbar, which is moving while the icon is spinning.
@michalsn Thanks for these comments! Good stuff, and exactly why I was wanting other eyes on this. I had missed the scrollbar wackiness. Maybe having the animation is more trouble than it is worth but I'll take another look at it. |
If this feature is associated with a tool bar, then it must be in the CodeIgniter\Debug namespace. |
I disagree. This is no more a toolbar feature than any of the other info panes are associated with the toolbar. There is a button on the toolbar that starts and stops it, but that is as far as the association goes.
I can operate without the toolbar if someone wanted to implement just a few lines of JS on their site. There's nothing that would stop it from working. However, in practice it does operate only when the toolbar is enabled, since it's currently the only way to start it. If the toolbar is disabled during while the hot reloader is active then the connection would be closed on page refresh. |
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.
Thanks, @lonnieezell - now it's working great!
Although there is still a small problem with this icon. True, the slider does not appear now, but the icon moves slightly up and down. This is probably a problem with selecting the wrong element in the DOM. We should be working on the img
element, not a
. I have added a code suggestion to solve this.
Why is it so difficult to get a PR to a place to make our 25 checks happy. This is so frustrating to work with anymore. PHP Linter is failing due to stuff that has nothing to do with this PR. I rebased against the current 4.4 branch and they're still there. I realized that I had put my CSS changes in the CSS file, forgetting that we had a SASS file in place, so I moved that change, ran dart sass locally as explained in our contributing docs, and all worked fine, but the tests are failing here. Why are we being forced to add @extends / @implements into the docblocks? How is this helpful at all? I'm actually curious. I've been programming PHP for 15 years and never needed it. It seems pretty obvious by looking at the class declaration what it extends and implements. What is the benefit? And what is the right lines to use in the IteractorFilter because I obviously don't have a clue. |
/** | ||
* @internal | ||
* | ||
* @extends RecursiveFilterIterator<RecursiveIterator> |
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.
@paulbalandan @kenjis What's the proper lines to have in the docblock here to make our static analysis happy?
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.
Something like this? But I don't know the exact types.
* @template-extends RecursiveFilterIterator<TKey, TValue, TIterator>
* @template-implements RecursiveIterator<TKey, TValue>
There is some question as to how useful this type information is, so we can suppress errors.
--- a/system/HotReloader/IteratorFilter.php
+++ b/system/HotReloader/IteratorFilter.php
@@ -17,8 +17,7 @@ use RecursiveIterator;
/**
* @internal
*
- * @extends RecursiveFilterIterator<RecursiveIterator>
- * @implements RecursiveIterator<RecursiveIterator>
+ * @psalm-suppress MissingTemplateParam
*/
final class IteratorFilter extends RecursiveFilterIterator implements RecursiveIterator
{
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.
Thank you, that works.
Rebase and composer update will solve the error. |
It is generics. It provide more type information that cannot express PHP syntax. When removing all tags:
|
Yeah, it is certainly too complicated to know what it is. |
Running sass will update
|
Co-authored-by: Michal Sniatala <[email protected]>
@kenjis Thanks for your help. I was pretty frustrated last night. I feel like every time I have a contribution I spend as long trying to appease the tools as I do working on the feature itself. It always seems to happen that you fix one tooling issue and more crop up. And, while I understand what generics are, my usage of them is limited to within Typescript when needed. But I just have to stop and think that if I find this so challenging to work with at times, I can't imagine what non-core contributors feel when they want to contribute and how many PRs this whole process has stopped from happening. |
And it's all green! |
I tested this feature a little with |
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.
🚀
Co-authored-by: kenjis <[email protected]>
See - I make changes to some user guide pages and suddenly Rector has issues in the RequestTrait that it didn't previously have. /sigh. Hopefully we don't need to address that for this and can get this merged. |
This is not related to this PR. |
Don't worry. Rector check fails now. See #7606 |
Thanks for merging! |
Excellent feature thanks !!! |
Glad you like it! |
i have small problem with this. |
This adds a new "Hot Reload" feature to the debug toolbar. When active, it will scan the app directory for any changes to files and instruct the browser to reload if any changes were found.
I still need to write tests, but submitting it so that others can try it out first and see if you encounter any problems. I've seen at least one strange thing but unsure if it is just my setup or a more widespread problem.
Checklist: