Skip to content
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

Watcher does not reload filters when they are changed #204

Closed
jonaslagoni opened this issue Feb 3, 2020 · 7 comments · Fixed by #341
Closed

Watcher does not reload filters when they are changed #204

jonaslagoni opened this issue Feb 3, 2020 · 7 comments · Fixed by #341
Assignees
Labels
bug Something isn't working released

Comments

@jonaslagoni
Copy link
Member

When using the watcher and you change the filter it does recognize the change, however they are never applied.

@jonaslagoni jonaslagoni added the bug Something isn't working label Feb 3, 2020
@fmvilas
Copy link
Member

fmvilas commented Feb 3, 2020

Not sure why this is happening but, without looking at it, I'm suspecting the watcher is ignoring hidden files and the .filters directory is hidden. Actually, any file starting with a dot is treated as a hidden file.

@jonaslagoni
Copy link
Member Author

jonaslagoni commented Feb 3, 2020

Not sure why this is happening but, without looking at it, I'm suspecting the watcher is ignoring hidden files and the .filters directory is hidden. Actually, any file starting with a dot is treated as a hidden file.

The watcher is recognizing the change in the hidden file, however when it re-generates it will not use the new filter, but use a cached one (the one first loaded when the command was first run).

@fmvilas fmvilas added this to the Make Generator stable milestone Mar 13, 2020
@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity 😴
It will be closed in 30 days if no further activity occurs. To unstale this issue, add a comment with detailed explanation.
Thank you for your contributions ❤️

@github-actions github-actions bot added the stale label May 13, 2020
@derberg derberg removed the stale label May 13, 2020
@derberg derberg self-assigned this May 14, 2020
@derberg
Copy link
Member

derberg commented May 14, 2020

I was able to reproduce the issue even with the current generator version where we keep templates separately and filters also separately from template files

@derberg
Copy link
Member

derberg commented May 14, 2020

after few hours of debugging I'm sure problem is here
https://github.com/asyncapi/generator/blob/master/lib/filtersRegistry.js#L39

If I read file like fs.readFileSync(filePath, 'utf8') it shows new content, but require brings initial module and not the new one.

@derberg
Copy link
Member

derberg commented May 14, 2020

after finding where the issues is, finding fix was easy
interesting read about modules cache -> https://bambielli.com/til/2017-04-30-node-require-cache/

will provide PR soon

@asyncapi-bot
Copy link
Contributor

🎉 This issue has been resolved in version 0.46.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants