We have seen that the
state.source.get() function and the
state.source.data object, while crucial to understand how
source and Frontity works, are hard to understand because:
- It’s hard to know that
state.source.get()returns things stored in
state.source.databecause their names don’t correlate.
- By just inspecting the state, it’s really hard to know that you should always use
state.source.get()and never access
- Both the
datanames don’t tell anything to the user about the type of data that they will return. Is it all the data or is it just a part?
As a Frontity beginner
I want to quickly understand how to access information about URLs
so that I can write my own logic faster
- Use a single name for both, so it’s clear that they are related.
- Change the name to show that it doesn’t contain all the data, only some information about that link.
My proposal is:
state.source.infoDatato store the objects.
That way, when people inspect
state.source in the console it will be easier to make a mental connection between them.
To keep backward compatibility, we can:
state.source.get()(but add a deprecation warning). We can even use derived state to return
state.source.datafor old handlers that write directly there.
state.source.infoshould look first in
state.source.infoObjectsbut if the info is not found there, it should still look in