This is an intermittent issue, 2/10 times "selection tag" doesn't reflect updated values when we navigate to other pages and come back to the same page.
All elements are showing updated values all time, except selectiontag which is built dynamically.
On using $w("#dynamicDataset").refresh, selectionTag shows updated value.
(This thread is a continuation of the previous Thread where Yisrael pointed to use a refresh. All worked fine, but on rigorous testing, I found this issue. Its intermittent)
![](https://static.wixstatic.com/media/a27d24_c9e47d3fa8394e2f90f8e53608e346c5~mv2.jpg/v1/fill/w_103,h_131,al_c,q_80,usm_0.66_1.00_0.01,blur_2,enc_auto/a27d24_c9e47d3fa8394e2f90f8e53608e346c5~mv2.jpg)
import wixData from 'wix-data';
import wixUsers from 'wix-users';
$w.onReady(async function () {
await $w('#dynamicDataset').onReady(() => {
$w("#dynamicDataset").refresh();
await populateSkill();
});
async function populateSkill() {
wixData.query("skillValues")
.limit(10)
// .ge('orderBy',95)
.find()
.then(results => {
var uniqueList = createUniqueList(results.items);
$w("#selectionTags1").options = buildOptions(uniqueList);
})
function createUniqueList(items) {
var titlesOnly = items.map(item => item.softSkills);
titlesOnly.sort();
return [...new Set(titlesOnly)];
}
function buildOptions(uniqueList) {
var uniqueListFinal = uniqueList.map(curr => { return { label: curr, value: curr }; });
// uniqueListFinal.unshift({ "label": "Others", "value": "Others" });
return uniqueListFinal;
}
}
export function dynamicDatasetCon_afterSave() {
$w('#dynamicDataset').onReady(() => {
$w("#dynamicDataset").refresh();
});
}
export function btnRefresh_click(event) {
$w("#dynamicDataset").refresh();
}
Thanx, so much Yisrael for your kind attention.
Here is the video of the intermittent issue...I see...the selectionTag "softwareTag" gets populated 4 times, only 5th time at 1:00 minute you can see it's not reflecting the correct values from dynamic dataset.
DynamicDataset captures, BioData of the consultant.
ps: There isn't any "Fetch after the page loads" on the dynamic dataset
Some observations:
The dataset.onReady() function should not have an await - this could result in unpredictable results. Also, the function contained within the onReady() should have async. Something like this:
$w('#dynamicDataset').onReady(async () => { $w("#dynamicDataset").refresh(); await populateSkill(); });
I don't understand what the refresh in the dataset.onReady() is for. When the dataset is ready, then it's ready - it shouldn't need to be refreshed.
What collection is your #dynamicDataset connected to?
I really don't understand what your problem is, but if it's associated with the #dynamicDataset, then you might want to set the Fetch After the Page Loads option and see if that helps.