Skip to content

Conversation

kbond
Copy link

@kbond kbond commented Sep 21, 2022

No description provided.

$response = null;

// todo ensure live
// todo check csrf token
Copy link
Author

Choose a reason for hiding this comment

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

You'll be sending the csrf token, right?

Copy link
Owner

Choose a reason for hiding this comment

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

yup - it'll be 1 CSRF token - stored on the header like normal - for the entire request.

'_component_action_args' => $action['args'] ?? [],
'_route' => 'live_component',
]);
// todo - only render on final action
Copy link
Author

Choose a reason for hiding this comment

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

Thinking to set a _render_component flag to false on every subrequest except the final one. In the subscriber, if this flag is set to false, just set the response to new Response(). Of course, only if the response from the action method is not provided.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, actually, this might not be necessary. We could tell ALL sub-requests to NOT render. Then, the ViewEvent / onKernelView() of our subscriber would trigger for the MAIN request and render the component in its "final" state. The "rendered" version of a component after the final action should === the rendered version on the main request after rendering all of the actions, unless I'm mistaken.

@kbond kbond force-pushed the batch-action-controller branch from a1379cc to a285e2f Compare September 21, 2022 18:10
}

$componentObject = $this->factory->get($component);
$mountedComponent = $this->hydrator->hydrate($componentObject, $data, $component);
Copy link
Owner

Choose a reason for hiding this comment

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

I was expecting all the stuff above this would still live in LiveComponentSubscriber - and then this controller is called (instead of __invoke() on the component or a real action method) only to handle the action execution.

@kbond kbond force-pushed the batch-action-controller branch from a285e2f to b4d546d Compare September 21, 2022 20:06
@weaverryan weaverryan closed this Oct 14, 2022
@kbond kbond deleted the batch-action-controller branch October 15, 2022 11:17
weaverryan added a commit that referenced this pull request Nov 1, 2022
# This is the 1st commit message:

WIP heavy refactoring to Component

Initial "hook" system used to reset model field after re-render

Adding a 2nd hook to handle window unloaded

reinit polling after re-render

Adding Component proxy

# This is the commit message #2:

fixing some tests

# This is the commit message #3:

Refactoring loading to a hook

# This is the commit message #4:

fixing tests

# This is the commit message #5:

rearranging

# This is the commit message #6:

Refactoring polling to a separate class
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants