bugfix: federation fetch error
When a long request to a source of a federation is made, in some cases, we could see some errors in the console and the list never loads (it happens only when the federation is in a range).
With 1 component, it works fine:
- componentA.getData()
- store gets
https://api.community.hubl.world/sources/skills/
- store caches
https://api.community.hubl.world/sources/skills/
- store finds a container inside, it fetches
https://api.community.hubl.world/skills/
- it waits...
- when the request resolves, resolve
getData
- store gets
With 2 components, it can fail in this case:
- componentA.getData()
- store gets
https://api.community.hubl.world/sources/skills/
- store caches
https://api.community.hubl.world/sources/skills/
- store finds a container inside, it fetches
https://api.community.hubl.world/skills/
- it waits...
- store gets
-
componentB.getData()
- finds
https://api.community.hubl.world/sources/skills/
in cache - gets the children
- finds resource with id:
https://api.community.hubl.world/skills/
- gets
https://api.community.hubl.world/skills/
from cache -> null
- finds
- componentA.getData() ...
- resolves only now
Here is a test case:
<solid-form
id="form"
data-src="https://api.community.startinblox.com/users/matthieu/"
range-skills="https://api.community.hubl.world/sources/skills/"
fields="skills"
multiple-skills="solid-multiple-select"
widget-skills="solid-form-auto-completion"
></solid-form>
<solid-display
id="display"
search-range-skills="https://api.community.hubl.world/sources/skills/"
search-fields="skills"
search-widget-skills="solid-form-placeholder-dropdown"
fields="first_name"
></solid-display>
<button id="test">test</button>
<script>
test.onclick=() => {
document.getElementById('display').dataset.src = "https://api.community.startinblox.com/users/";
}
</script>
To make it fails, we need the solid-display to load the skills when https://api.community.hubl.world/sources/skills/
has resolved. You can make it happen by clicking the test button as soon as the page loads.