-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enhancement/incremental community fields #643
Enhancement/incremental community fields #643
Conversation
…jectives loading and error
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🐎
) | ||
community.objectives | ||
|> List.head | ||
List.find (.id >> (==) model.objectiveId) objectives |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
took a minute to got what was going there >>
operator is weird
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in a good way 👽
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, point-free can be confusing sometimes.
In this case I kind of like how it reads if you just ignore all the punctuation:
find [something where] id == model.objectiveId
What issue does this PR close
Closes #640
Changes Proposed ( a list of new changes introduced by this PR)
BroadcastMsg
:CommunityFieldLoaded
uploads
eobjectives
não são mais carregados junto com a comunidade. Podemos usar aBroadcastMsg
acima para pedir aoLoggedIn
fazer uma query e pegar esses camposLista de todos os campos afetados:
Esse PR estabelece uma boa estrutura para termos mais campos que podem ser carregados separados da comunidade. Para adicionar um novo campo nesse estilo:
Community.Model
com um tipo deRemoteData (Graphql.Http.Error field) field
Field
. O nome deve ser composto do nome do campo seguido porField
(e.g.ObjectivesField
)FieldValue
. O nome deve ser composto do nome do campo seguido porValue
, e possuir o valor do campo (e.g.ObjectivesValue (List Objective)
)setFieldValue
,setFieldAsLoading
,isFieldLoading
emaybeFieldValue
)Páginas podem solicitar o campo usando as mensagens
LoggedIn.External
:RequestedCommunityField Community.Field
recebe umCommunity.Field
, e verifica se aselectedCommunity
deloggedIn
já possui o campo. Se sim, manda o valor por umaBroadcastMsg
. Se não, executa uma query para buscar o campo e envia umaBroadcastMsg
quando receber o resultado.RequestedReloadCommunityField
é similar à mensagem acima, mas sempre executa a query para buscar o campo. Útil para forçar o reload de algum campo.Para receber o campo, devem usar um
receiveBroadcast
, fazendo pattern match emLoggedIn.CommunityFieldLoaded
e o campo desejado (e.g.LoggedIn.CommunityFieldLoaded community (Community.Objectives objectives)
). O objetocommunity
é repassado para evitar estados impossíveis, onde o campo está carregado, mas a comunidade não.How to test ( a list of instructions on how to test this PR)