fix issue with files loading with watching enabled (#3930)
This commit is contained in:
parent
702e75635c
commit
a0134de979
@ -53,6 +53,8 @@ const DocumentSyncQueue = {
|
|||||||
* @returns {boolean} - true if the document can be watched, false otherwise
|
* @returns {boolean} - true if the document can be watched, false otherwise
|
||||||
*/
|
*/
|
||||||
canWatch: function ({ title, chunkSource = null } = {}) {
|
canWatch: function ({ title, chunkSource = null } = {}) {
|
||||||
|
if (!chunkSource) return false;
|
||||||
|
|
||||||
if (chunkSource.startsWith("link://") && title.endsWith(".html"))
|
if (chunkSource.startsWith("link://") && title.endsWith(".html"))
|
||||||
return true; // If is web-link material (prior to feature most chunkSources were links://)
|
return true; // If is web-link material (prior to feature most chunkSources were links://)
|
||||||
if (chunkSource.startsWith("youtube://")) return true; // If is a youtube link
|
if (chunkSource.startsWith("youtube://")) return true; // If is a youtube link
|
||||||
|
|||||||
@ -361,9 +361,6 @@ async function fileToPickerData({
|
|||||||
const filename = path.basename(pathToFile);
|
const filename = path.basename(pathToFile);
|
||||||
const fileStats = fs.statSync(pathToFile);
|
const fileStats = fs.statSync(pathToFile);
|
||||||
const cachedStatus = await cachedVectorInformation(cachefilename, true);
|
const cachedStatus = await cachedVectorInformation(cachefilename, true);
|
||||||
const canWatchStatus = liveSyncAvailable
|
|
||||||
? DocumentSyncQueue.canWatch(metadata)
|
|
||||||
: false;
|
|
||||||
|
|
||||||
if (fileStats.size < FILE_READ_SIZE_THRESHOLD) {
|
if (fileStats.size < FILE_READ_SIZE_THRESHOLD) {
|
||||||
const rawData = fs.readFileSync(pathToFile, "utf8");
|
const rawData = fs.readFileSync(pathToFile, "utf8");
|
||||||
@ -381,7 +378,9 @@ async function fileToPickerData({
|
|||||||
type: "file",
|
type: "file",
|
||||||
...metadata,
|
...metadata,
|
||||||
cached: cachedStatus,
|
cached: cachedStatus,
|
||||||
canWatch: canWatchStatus,
|
canWatch: liveSyncAvailable
|
||||||
|
? DocumentSyncQueue.canWatch(metadata)
|
||||||
|
: false,
|
||||||
// pinnedWorkspaces: [], // This is the list of workspaceIds that have pinned this document
|
// pinnedWorkspaces: [], // This is the list of workspaceIds that have pinned this document
|
||||||
// watched: false, // boolean to indicate if this document is watched in ANY workspace
|
// watched: false, // boolean to indicate if this document is watched in ANY workspace
|
||||||
};
|
};
|
||||||
@ -429,7 +428,7 @@ async function fileToPickerData({
|
|||||||
type: "file",
|
type: "file",
|
||||||
...metadata,
|
...metadata,
|
||||||
cached: cachedStatus,
|
cached: cachedStatus,
|
||||||
canWatch: canWatchStatus,
|
canWatch: liveSyncAvailable ? DocumentSyncQueue.canWatch(metadata) : false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user