fix: redirection and cache

This commit is contained in:
Jean-Baptiste Pasquier 2020-04-20 13:56:46 +02:00
parent fa9e8317bc
commit 4f051b345d
No known key found for this signature in database
GPG Key ID: F2702E6D22ED4D62
2 changed files with 15 additions and 2 deletions

View File

@ -91,6 +91,17 @@ function refreshSibDisplays(resourceId, clearCache = true) {
}); // and update them
}
async function updateSources(resource) {
let res = resource.split('/');
res.splice(3, 0, 'sources');
let cacheCleared = false;
if (event.target.component.resource != null) {
event.target.component.resource.clearCache();
cacheCleared = true;
}
refreshSibDisplays(res.join('/'),cacheCleared);
}
//auxiliary function updates displays using a given resource
//NOTE: this is a temporary workaround and should be replaced by a reactive storage
//https://git.happy-dev.fr/startinblox/framework/sib-core/issues/524
@ -98,6 +109,7 @@ async function refreshResource(event) {
// if of the edited resource || id of the container of the created resource
const resourceId = event.detail.resource["@id"] || event.target.dataset.src;
updateSources(resourceId, event);
let resource = document
.querySelector('[data-src="' + resourceId + '"]')
.component.resource.getResourceData();
@ -106,8 +118,9 @@ async function refreshResource(event) {
let partnerId = null;
if (resourceId.includes("circle-members")) {
partnerId = resource["http://happy-dev.fr/owl/#circle"]["@id"];
} else if (resourceId.includes("project-members"))
} else if (resourceId.includes("project-members")) {
partnerId = resource["http://happy-dev.fr/owl/#project"]["@id"];
}
//refresh all resources using the partner ID
if (partnerId != null) {

View File

@ -27,7 +27,7 @@ div.content-box__info
value-password=''
widget-password='sib-form-hidden'
next='admin-user-list'
next='admin-users-list'
submit-button='Create'
)