Thanks for chiming in, Juanma.
I totally agree with this, we should use info
for the description of the resource:
const info = state.source.info("/some-url");
and data
to refer to the real data of the resource:
const info = state.source.info("/some-url");
const data = state.source[info.type][info.id];
in our code and our docs.
For that reason, I think state.source.info
makes sense.
The way I see it, state.source.getLinkInfo
doesn’t add much value over state.source.info
and it’s longer to write and to remember (“Was getLinkInfo
or getInfoLink
?”").
And the problem I see with using something like state.source.links
for the info objects is that it’s not clear that that is a “store” only, and shouldn’t be accessed directly.
// This is wrong, but it's not obvious:
const info = state.source.links["/some-url"];
// This is right:
const info = state.source.info("/some-url");
That’s the reason I propose the use something like state.source.infoObjects
, so people is not tempted to access it directly and they stick to state.source.info
.
// This is wrong. I think it's a bit more obvious.
const info = state.source.infoObjects["/some-url"];
// This is right:
const info = state.source.info("/some-url");
I don’t mean this is perfect, it’s just my reasoning behind it.