mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
fixes: CSA for button(component) does not work for page event handler.
This commit is contained in:
parent
066c369c63
commit
bd05db68d2
2 changed files with 5 additions and 12 deletions
|
|
@ -199,15 +199,6 @@ const EditorComponent = (props) => {
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Ref to store the previous appDefinition for comparison
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (mounted && currentUser?.current_organization_id) {
|
|
||||||
fetchGlobalDataSources();
|
|
||||||
}
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [JSON.stringify(currentUser?.current_organization_id)]);
|
|
||||||
|
|
||||||
// Handle appDefinition updates
|
// Handle appDefinition updates
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const didAppDefinitionChanged = !_.isEqual(appDefinition, prevAppDefinition.current);
|
const didAppDefinitionChanged = !_.isEqual(appDefinition, prevAppDefinition.current);
|
||||||
|
|
@ -670,10 +661,9 @@ const EditorComponent = (props) => {
|
||||||
isUpdatingEditorStateInProcess: false,
|
isUpdatingEditorStateInProcess: false,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
await useDataSourcesStore.getState().actions.fetchGlobalDataSources(data?.organization_id);
|
||||||
await fetchDataSources(data.editing_version?.id);
|
await fetchDataSources(data.editing_version?.id);
|
||||||
await fetchDataQueries(data.editing_version?.id, true, true);
|
await fetchDataQueries(data.editing_version?.id, true, true);
|
||||||
await fetchGlobalDataSources();
|
|
||||||
|
|
||||||
const currentPageEvents = data.events.filter((event) => event.target === 'page' && event.sourceId === homePageId);
|
const currentPageEvents = data.events.filter((event) => event.target === 'page' && event.sourceId === homePageId);
|
||||||
|
|
||||||
for (const currentEvent of currentPageEvents ?? []) {
|
for (const currentEvent of currentPageEvents ?? []) {
|
||||||
|
|
|
||||||
|
|
@ -616,7 +616,10 @@ export async function onEvent(_ref, eventName, events, options = {}, mode = 'edi
|
||||||
|
|
||||||
const { customVariables } = options;
|
const { customVariables } = options;
|
||||||
if (eventName === 'onPageLoad') {
|
if (eventName === 'onPageLoad') {
|
||||||
await executeActionsForEventId(_ref, 'onPageLoad', events, mode, customVariables);
|
//hack to make sure that the page is loaded before executing the actions
|
||||||
|
setTimeout(async () => {
|
||||||
|
return await executeActionsForEventId(_ref, 'onPageLoad', events, mode, customVariables);
|
||||||
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (eventName === 'onTrigger') {
|
if (eventName === 'onTrigger') {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue