Modify query results before displaying with a repeater

Question:
Is it possible to modify the query result from a WIX data query before sending it to a repeater?

Product:
Wix Studio Editor

What are you trying to achieve:
I want to limit the chars displayed in a field based on viewport.

What have you already tried:
I tried this code for a single result set but without success.

wixData
.query(“Library”)
.contains(“summary”, searchTokens[0])
.find()
.then((res) => {
let shortenedSummaryDisplay = res.items[0].summaryDisplay.substr(0, 25) + " … “;
res.items[0].summaryDisplay = shortenedSummaryDisplay;
$w(”#libraryRepeater").data = res.items;
});

Additional information:
Typically several query items are returned and I would want to iterate through the array of results and modify the summaryDisplay node to shorten it for each array item.

You can definitely do that, but since you’re not modifying anything about the query itself, you should just leave it like that, and have the repeater itself limit the text within it

Something like this:

$w(‘#repeater’).onItemReady(($item, itemData) => {
    let description = itemData.description
    if (description.length > 43) description = description.slice(0, 40) + ‘…’
    $item(‘#shortDescription’).text = description
})

It makes sense that to modify the text I want to modify within the repeater. The page is a Library Search page that allows a user to find a specific document. Using the $w(‘#repeater’).onItemReady(($item, itemData) => { watcher didn’t work and I suspect it’s because the repeater doesn’t get called until after a search function is called that populates the repeater.

$w(”#libraryRepeater").data = res.items;

I don’t understand the repeater lifecycle well and so am not sure when the $w(‘#repeater’).onItemReady is called.