Skip to content

Commit c5470e5

Browse files
committed
fix: link-preview double-parse
Instead of having link preview plugin CLEAR the post cache after rendering the new post content, the plugin will now SET the new content in the post cache.
1 parent 891f84c commit c5470e5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

library.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const { isURL } = require('validator');
1414
const meta = require.main.require('./src/meta');
1515
const cache = require.main.require('./src/cache');
1616
const posts = require.main.require('./src/posts');
17+
const postsCache = require.main.require('./src/posts/cache');
1718
const websockets = require.main.require('./src/socket.io');
1819

1920
const controllers = require('./lib/controllers');
@@ -201,7 +202,9 @@ async function process(content, { type, pid, tid, attachments }) {
201202

202203
// bust posts cache item
203204
if (pid) {
204-
posts.clearCachedPost(pid);
205+
const cache = postsCache.getOrCreate();
206+
const cacheKey = `${String(pid)}|default`;
207+
cache.set(cacheKey, content);
205208

206209
// fire post edit event with mocked data
207210
if (tid) {

0 commit comments

Comments
 (0)