I’m having trouble getting server.js to update existing data in a way that the state is updated in the client.
I needed to access some external data using an API key, so I created server.js and client.js files and defined the handler in server.js and custom actions in client.js. In the handler, I set the data as shown below. This updates state on the server but in the browser state it is still the same as when it first loaded in the app.
state.source.data[link] = {
isForum: true,
isReady: true,
messages: [...messages]
};
In the client, I fetch the data from the custom handler with the pattern I defined. I added the option force: true
as suggested elsewhere in this forum. I expected that adding this option would be enough to force refresh the data set in the handler. I see the component attempt to refresh but the data is the same, which can be confirmed in the console.
await actions.source.fetch("/messages/", { force: true });
I hope someone can help me correctly update the state of existing data from server.js to client.js.