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

member.interests should return [] not null. #73

Closed
theClarkSell opened this issue Oct 5, 2020 · 3 comments
Closed

member.interests should return [] not null. #73

theClarkSell opened this issue Oct 5, 2020 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@theClarkSell
Copy link
Member

Currently members.member.interests returns null if there are no interests. I'm guessing that's because interests might not have ever been set for that user. It would be nice if that defaulted to an empty array rather than null.

@theClarkSell theClarkSell added the enhancement New feature or request label Oct 5, 2020
@brettski
Copy link
Collaborator

brettski commented Oct 5, 2020

Interests is an array field in Firestore. Most users don't have this field so it will return as null/undefined.

I am not sure on the best approach here. Some initial thoughts:

  1. update all records to include an interests field
  2. update cloudFirestore queries to include an interests field if not present.
  • this seems a bit error prone and would need to be remembered in future updates
  1. update resolver to handle a missing interests field.
  • this feels wrong like the last one

@brettski
Copy link
Collaborator

brettski commented Oct 6, 2020

The more I thought about this, the data should be fixed. A two+ step process is in place.

  1. Update members api to ensure the interests field is always written. If there is no value set, [] will be written.
  2. Run a query to update all current records where interests doesn't exist or is set to null.
  3. update that-website to correctly write value to database. (less important due to 1 being in place)

@brettski
Copy link
Collaborator

brettski commented Oct 6, 2020

This has been corrected. As per my last comment:

  1. pr merged which ensure that the interests field exists and is an array value.
  2. member records updated so all have an interests field and that field has an array value
  3. issue has been created in that-website for it writing null to interest field Interests saved as null if no values provided. Should save as [] that-website#595

@brettski brettski closed this as completed Oct 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants