Open lucassimines opened 3 years ago
I resolved the issue by removing the following lines:
// if nothing change (new appears as changed)
if(!forceGenerateSlug && !changed) {
return instance;
}
Thank you, that is helpful. I am not sure removing that is the best course of action as it will likely have other side effects.
I will have to look into why DataTypes.VIRTUAL
is not generating the slug.
It appears that fields of type DataTypes.VIRTUAL
are not detected as changed, which makes sense as there is no way to know the previous version since it is not a stored field.
The documentation referenced appears to have been added without unit tests to back it up :(
I will continue to investigate, but in the meantime, it may be safer to manually call regenerateSlug()
as in the unit test that I added.
https://github.com/jarrodconnolly/sequelize-slugify/blob/main/jest-tests/slug-generation.test.js#L70
@jarrodconnolly any update about this?
@jarrodconnolly Hey :-). Any updates on this, and a side question, is the library still being maintained? Some of these issues have been here for a while, and I wonder if you maybe need a hand with this? I'm happy to help if you are willing to pair on it.
Cheers
Hello, thank you for your comments.
This library is still maintained, I try to investigate and solve any issues as they come up. This issue was left open because at the time could only find a workaround as described and added a unit test to show the issue.
I am always open to pull requests or suggestions on how to solve issues.
What steps will reproduce the bug?
How often does it reproduce? Is there a required condition?
What is the expected behavior?
The
slug
column is not getting_title
Virtual column as the documentation says.What do you see instead?
Additional information