-
Notifications
You must be signed in to change notification settings - Fork 2
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: Disabling while in 'serve' mode after first run #5
Fix: Disabling while in 'serve' mode after first run #5
Conversation
5639c16
to
b60c5c1
Compare
Hi, first of all; thanks for catching this bug and sorry for the review delay from my side! Great find :) Second: I hope I didn't explain this too complicated 😅, but the gist is that maybe it's better to keep one final source of truth that decides if the plugin's functionality should be enabled instead of checking for multiple variables ( What do you think about that? @Sewer56 |
That's a good idea actually, didn't think of unifying the value, would keep things simpler. I'll get this sorted later today. |
Oops, I forgot about this for a second somehow. |
Hi, thanks for the addition @Sewer56 I just quickly added a commit running the formatter ( I will release a new version including this change later today! |
No worries. And yeah, it does remind me, there's no decent universal ways to set things up like pre-commit hooks to automatically kick in locally. Every user has to manually init. I do know it's possible to set up bots to format all incoming PRs provided user enables 'allow edits by maintainer' when submitting, but I've never looked into it much. |
Yeah, tbh I agree, pre-commit hooks are not that optimal |
This fixes a case where rebuilding the documentation when running in serve mode will ignore the
enabled_on_serve
.When running exclude-unused-files in conjunction with
mkdocs-material
(9.5.25), I noticed that runs after the first run inserve
mode were ignoring theenabled_on_serve
flag. First run would be 1.3s, second would be 5.0 seconds.After some log debugging, it turns out that
self.config
is actually reset between build runs inserve
mode. And therefore settingself.config.enabled = False
was not sticking.To account for that, I stored an alternative variable
disabled_by_serve
that's tied to the self variable, outside of the config. This way, it should not be reset between runs.Please Note: I've never really programmed in Python before, so debugging this has been a unique experience. 😅