Skip to content

Conversation

xDeSwa
Copy link
Contributor

@xDeSwa xDeSwa commented Sep 18, 2025

Q A
Bug fix? yes
New feature? no
Docs? no
Issues >
License MIT

After the URL change, performing the render:finished event will provide smoother control.

@carsonbot carsonbot added the Status: Needs Review Needs to be reviewed label Sep 18, 2025
@carsonbot carsonbot changed the title render hook fix render hook fix Sep 18, 2025
Copy link
Contributor

github-actions bot commented Sep 18, 2025

📊 Packages dist files size difference

ℹ️ No difference in dist packagesFiles.

@xDeSwa xDeSwa changed the title render hook fix [LiveComponent] render hook fix Sep 18, 2025
@Kocal Kocal changed the title [LiveComponent] render hook fix [LiveComponent] Replace the browser's URL before triggering render:finished hook Sep 19, 2025
Copy link
Member

@Kocal Kocal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Sep 19, 2025
@Kocal Kocal requested review from kbond and smnandre September 19, 2025 07:55
@carsonbot carsonbot added Status: Needs Review Needs to be reviewed and removed Status: Reviewed Has been reviewed by a maintainer labels Sep 19, 2025
new URL(liveUrl + window.location.hash, window.location.origin)
);
}
this.hooks.triggerHook("render:finished", this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we movev the liveUrl update in processRerender instead ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be careful on how we do it, because the method contains some early returns that could prevent the URL update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done. moved into processRerender

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But now people hooking on render:started and passing shouldRender = false won't see the URL updated anymore, that's a BC

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep indeed.. but if I get this right, with this PR the hook would be trigger even when the render is skipped or if an error occurs .. and this would be some BC too :| Or do we consider this a bug ?

But there are at least two places we need to check attentively how it would impact codebases:

This one (seems without effect but i'd like to be sure):

        component.on('render:finished', () => {
            // re-start polling, in case polling changed
            this.initializePolling();
        });

/src/LiveComponent/assets/src/Component/plugins/PollingPlugin.ts#L21-L24

But this one makes me more hesitant:

    attachToComponent(component: Component): void {
        this.synchronizeValueOfModelFields(component);
        component.on('render:finished', () => {
            this.synchronizeValueOfModelFields(component);
        });

src/LiveComponent/assets/src/Component/plugins/SetValueOntoModelFieldsPlugin.ts#L16-L18

@xDeSwa xDeSwa force-pushed the livecomponent-hook-render-fix branch from ea8124e to 2fd6689 Compare September 20, 2025 07:06
@xDeSwa
Copy link
Contributor Author

xDeSwa commented Sep 27, 2025

@Kocal | @smnandre
URL change method moved before ReRender function.

Since no backendResponse data changes are made within the ReRender function, changing the URL before the function makes sense. This will avoid any hitches to hook operations and ensure access to the correct URL within the hook.

@smnandre
Copy link
Member

Seems ok to me! Can you fix fabbot check ? (remove the merge commit and rebase on 2.x) .. or we won't be able to merge 😅

@xDeSwa xDeSwa force-pushed the livecomponent-hook-render-fix branch from 9682569 to 7b2fc19 Compare September 28, 2025 09:26
@xDeSwa
Copy link
Contributor Author

xDeSwa commented Sep 28, 2025

@smnandre is it ok now? thanks

@smnandre
Copy link
Member

Well, i do not see any red in the checks box so .. yeah 😄

Copy link
Member

@smnandre smnandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @xDeSwa !!

@carsonbot carsonbot added Status: Reviewed Has been reviewed by a maintainer and removed Status: Needs Review Needs to be reviewed labels Sep 28, 2025
@smnandre smnandre removed the Bug Bug Fix label Sep 28, 2025
@Kocal Kocal force-pushed the livecomponent-hook-render-fix branch from 7b2fc19 to 1b0418f Compare October 1, 2025 19:43
@Kocal
Copy link
Member

Kocal commented Oct 1, 2025

Thank you @xDeSwa.

@Kocal Kocal merged commit 007db4e into symfony:2.x Oct 1, 2025
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LiveComponent Status: Reviewed Has been reviewed by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants