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

Migration for tags rename #47

Closed
Grohden opened this issue Nov 28, 2018 · 4 comments
Closed

Migration for tags rename #47

Grohden opened this issue Nov 28, 2018 · 4 comments
Labels
docs Documentation update

Comments

@Grohden
Copy link
Contributor

Grohden commented Nov 28, 2018

When a wendy task is created the tag is saved as a string, normally you use something like

    val TAG: String = Clazz::class.java.simpleName

But if you rename the class all current pending tasks break.. forcing you to cry clear the app data. is there any way to solve that now with wendy api?
Also, this should be warned in the docs.
Note: i'm using 0.2.1-alpha

@levibostian levibostian added the docs Documentation update label Nov 29, 2018
@levibostian
Copy link
Owner

levibostian commented Nov 29, 2018

At this time, no, there is not a migration feature. There also may never be.

I have thought about this issue before and decided that a migration feature would be too complex of a solution to solve the problem.

The problem is that after you change a class's name, the tag's name is now changed and Wendy can no longer run those tasks.

The solution that I felt was the best way to solve the problem is instead of using: val TAG: String = Clazz::class.java.simpleName as the tag, use a String: val TAG: String = "Clazz". So if you ever change the name of Clazz, nothing is broken.

Thank you for the message so I can update the docs. I have been using strings in my own apps these days anyway. I like to use a description like: "Update users profile photo" as the tag. I feel that it is more universal then UploadProfilePhotoPendingTask::class.java.simpleName.

I do not see a way to remove the need for tags at this time so the best way we can solve this problem is with best practices and docs. That would be a great way to fix this.

Would you like to update the README and send a pull request? Feel free!

@Grohden
Copy link
Contributor Author

Grohden commented Nov 29, 2018

@levibostian i understand, i just opened this because of the need to document it, if you release an app and rename a tag you would have some problems to fix that... but wendy error message at least make it easy to find the error <3

I'll try to make a PR, it will take some weeks till i get some time for that.
Also, your suggestion to use a string should be in best practices...

Note: I'm kind of annoyed that the README syntax highlight is not configured for Kotlin, I'll fix that too

@levibostian
Copy link
Owner

@Grohden I agree with everything you stated.

  1. Using a descriptive string should be the best practice. Add a note to the docs that this should be the best practice.
  2. Share that the descriptive string should not change. This allows you to change the name of your PendingTask and Wendy works as expected.
  3. Add Kotlin syntax highlighting to readme 😄. Agreed!

Thanks for creating the issue. This is a fix that needs to be done.

Grohden added a commit to Grohden/Wendy-Android that referenced this issue Dec 7, 2018
@levibostian
Copy link
Owner

Closed by #49

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation update
Projects
None yet
Development

No branches or pull requests

2 participants