mirror of
https://github.com/n8n-io/n8n.git
synced 2026-10-12 02:19:43 +00:00
fix(editor): Clear resource locator cache after URL redirect creation (#27175)
Co-authored-by: Claude Opus 4.6 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
6ede5e1ec7
commit
d8f8ff0980
+40
@@ -482,6 +482,46 @@ describe('ResourceLocator', () => {
|
||||
expect(nodeTypesStore.getNodeParameterActionResult).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('clears cached resources after URL redirect so fresh data is fetched on re-open', async () => {
|
||||
const TEST_ITEMS = [{ name: 'Old Table', value: 'old-table' }];
|
||||
const TEST_ITEMS_UPDATED = [
|
||||
{ name: 'Old Table', value: 'old-table' },
|
||||
{ name: 'New Table', value: 'new-table' },
|
||||
];
|
||||
|
||||
nodeTypesStore.getResourceLocatorResults
|
||||
.mockResolvedValueOnce({ results: TEST_ITEMS, paginationToken: null })
|
||||
.mockResolvedValueOnce({ results: TEST_ITEMS_UPDATED, paginationToken: null });
|
||||
|
||||
const { getByTestId, getByText } = renderComponent({
|
||||
props: {
|
||||
modelValue: { __rl: true, value: '', mode: 'list' },
|
||||
parameter: TEST_PARAMETER_URL_REDIRECT,
|
||||
path: `parameters.${TEST_PARAMETER_URL_REDIRECT.name}`,
|
||||
node: TEST_NODE_URL_REDIRECT,
|
||||
displayTitle: 'Test Resource Locator',
|
||||
expressionComputedValue: '',
|
||||
},
|
||||
});
|
||||
|
||||
// Open dropdown — first fetch returns old data
|
||||
await fireEvent.focus(getByTestId('rlc-input'));
|
||||
await waitFor(() => {
|
||||
expect(nodeTypesStore.getResourceLocatorResults).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
expect(getByText('Old Table')).toBeInTheDocument();
|
||||
|
||||
// Click "Create new" — opens URL and clears cache
|
||||
await userEvent.click(getByTestId('rlc-item-add-resource'));
|
||||
|
||||
// Re-open dropdown — should fetch fresh data since cache was cleared
|
||||
await fireEvent.focus(getByTestId('rlc-input'));
|
||||
await waitFor(() => {
|
||||
expect(nodeTypesStore.getResourceLocatorResults).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
expect(getByText('New Table')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('slow load notice', () => {
|
||||
it('should pass slowLoadNotice configuration to dropdown component', async () => {
|
||||
vi.useFakeTimers();
|
||||
|
||||
+1
@@ -419,6 +419,7 @@ const handleAddResourceClick = async () => {
|
||||
}
|
||||
|
||||
hideResourceDropdown();
|
||||
refreshList();
|
||||
openResource(resolvedUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user