feat(plugins): enhance documentation request handling to prevent unnecessary reloads #11911
+13
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes are being made and why?
Solves: #11650
Original Problem: When you tried to view documentation while having unsaved changes in your flow, you would get an unwanted "unsaved changes" warning. This was happening because:
- Actually modifying the flow content
- Just viewing documentation about the flow's components
How the changes have been QAed?
function isTabFlowRelated(element: Tab){ // Skip marking doc tab as dirty to avoid unsaved changes warning if (element.value === "doc") { return false; } return ["code", "nocode", "topology"].includes(element.value) || element.value.startsWith("nocode-") }
This prevents documentation tabs from affecting the flow's dirty state.
In EditorWrapper.vue:
let result = selectedElement ? getElementFromRange(selectedElement) : undefined; // Flag this as a documentation request result = {...result, hash: hash.value, forceRefresh: true, isDocumentationRequest: true}; pluginsStore.updateDocumentation(result);
Now explicitly flags documentation requests.
In plugins.ts:
async updateDocumentation(pluginElement?: ({ type: string, version?: string, forceRefresh?: boolean, isDocumentationRequest?: boolean } & Record<string, any>)) { // Special handling for documentation requests if (isDocumentationRequest && this.editorPlugin?.cls === type && !forceRefresh) { return; } // ... rest of the function }
Adds special handling for documentation requests.
To Verify the Fix: You can test the following scenarios:
Make some changes to a flow but don't save
Try to:
You should NOT see any unsaved changes warnings
However, if you try to navigate away from the flow editor with actual unsaved changes, you should still get the warning