Closed cfc7-unikent closed 6 years ago
this is posting to http://astro.dev/api/v1/pages/0 which is the wrong page for the one I'm looking at. So I'm assuming this is actually an editor bug
Looks like this regression was introduced in upgrade to element 2 when the EditPageModal was modified to use :visible.sync="visible"
which I think means that the setter for its visible
computed property is no longer being called.
The setter for visible https://github.com/unikent/astro/blob/08f9bca655b4703881b88f6da287908b5183daf2/resources/assets/js/components/EditPageModal.vue#L67 is only being called when the close button is clicked (with no value / false value).
It doesn't seem to be called when the dialog is displayed.
The same is happening with the CreatePageModal https://github.com/unikent/astro/blob/08f9bca655b4703881b88f6da287908b5183daf2/resources/assets/js/components/CreatePageModal.vue#L108 except that the logic in that sets the necessary values in the getter, not the setter, so it still works.
All seems a bit odd to me. Hopefully @theninja can explain it on monday.
Yeah, this is where I'd got to in my poking around this morning.
I'm not even sure how that bit of logic which copies the data from the state into the edit form ever was reached. I'm assuming I'm just not understanding something. I need a new brain download from Jack.
This is tied to an old issue I've "fixed" where the modal visibility was being set to true (the setter was called with a value of true
), after a mapped piece of state in the store was set to true. This meant stuff could be triggered twice for no real reason. I didn't rely on this functionality anywhere because I felt it was strange behaviour. I had a look at Element UI this morning, and it was there in el-dialog < v2 but has been fixed in the later versions (it only updates with a false value), which seems like the right way to do it 😃.
So, basically, in this particular component we were relying on broken behaviour in Element UI.
Fixed in #218.
It feels a bit yucky, but we can put in place a longer term solution, possibly using events for modals since that doesn't feel as weird as using the state like we are currently.
this works and I've merged it in.
Agree with everything you say about 'yucky'ness and at looking at a different approach for the longer term.
Nice to know that this was all working due to some internal Element weirdness. I was honestly massively confused trying to see how it ever worked before.
(this could be api or editor side, note looked yet)
Response from API call by editor is
{"errors":[{"message":"Not Found","details":"Illuminate\\Database\\Eloquent\\ModelNotFoundException","trace":[{"file":"\/Users\/christiancable\/Code\/valet\/astro\/app\/Providers\/RouteServiceProvider.php","line":40,"function":"firstOrFail","class":"Illuminate\\Database\\Eloquent\\Builder","type":"->","args":[]},{"function":"App\\Providers\\{closure}","class":"App\\Providers\\RouteServiceProvider","type":"->","args":["0",{"uri":"api\/v1\/pages\/{page}","methods":["PUT","PATCH"],"action":{"middleware":"api","as":"pages.update","uses":"App\\Http\\Controllers\\Api\\v1\\PageController@update","controller":"App\\Http\\Controllers\\Api\\v1\\PageController@update","namespace":"App\\Http\\Controllers\\Api\\v1","prefix":"api\/v1","where":[]},"controller":{},"defaults":[],"wheres":[],"parameters":{"page":"0"},"parameterNames":["page"],"computedMiddleware":["api"],"compiled":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php","line":661,"function":"call_user_func","args":[{},"0",{"uri":"api\/v1\/pages\/{page}","methods":["PUT","PATCH"],"action":{"middleware":"api","as":"pages.update","uses":"App\\Http\\Controllers\\Api\\v1\\PageController@update","controller":"App\\Http\\Controllers\\Api\\v1\\PageController@update","namespace":"App\\Http\\Controllers\\Api\\v1","prefix":"api\/v1","where":[]},"controller":{},"defaults":[],"wheres":[],"parameters":{"page":"0"},"parameterNames":["page"],"computedMiddleware":["api"],"compiled":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php","line":633,"function":"performBinding","class":"Illuminate\\Routing\\Router","type":"->","args":["page","0",{"uri":"api\/v1\/pages\/{page}","methods":["PUT","PATCH"],"action":{"middleware":"api","as":"pages.update","uses":"App\\Http\\Controllers\\Api\\v1\\PageController@update","controller":"App\\Http\\Controllers\\Api\\v1\\PageController@update","namespace":"App\\Http\\Controllers\\Api\\v1","prefix":"api\/v1","where":[]},"controller":{},"defaults":[],"wheres":[],"parameters":{"page":"0"},"parameterNames":["page"],"computedMiddleware":["api"],"compiled":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Middleware\/SubstituteBindings.php","line":37,"function":"substituteBindings","class":"Illuminate\\Routing\\Router","type":"->","args":[{"uri":"api\/v1\/pages\/{page}","methods":["PUT","PATCH"],"action":{"middleware":"api","as":"pages.update","uses":"App\\Http\\Controllers\\Api\\v1\\PageController@update","controller":"App\\Http\\Controllers\\Api\\v1\\PageController@update","namespace":"App\\Http\\Controllers\\Api\\v1","prefix":"api\/v1","where":[]},"controller":{},"defaults":[],"wheres":[],"parameters":{"page":"0"},"parameterNames":["page"],"computedMiddleware":["api"],"compiled":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Routing\\Middleware\\SubstituteBindings","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Auth\/Middleware\/Authenticate.php","line":43,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Auth\\Middleware\\Authenticate","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{},"api"]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":102,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php","line":576,"function":"then","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php","line":535,"function":"runRouteWithinStack","class":"Illuminate\\Routing\\Router","type":"->","args":[{"uri":"api\/v1\/pages\/{page}","methods":["PUT","PATCH"],"action":{"middleware":"api","as":"pages.update","uses":"App\\Http\\Controllers\\Api\\v1\\PageController@update","controller":"App\\Http\\Controllers\\Api\\v1\\PageController@update","namespace":"App\\Http\\Controllers\\Api\\v1","prefix":"api\/v1","where":[]},"controller":{},"defaults":[],"wheres":[],"parameters":{"page":"0"},"parameterNames":["page"],"computedMiddleware":["api"],"compiled":{}},{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Router.php","line":513,"function":"dispatchToRoute","class":"Illuminate\\Routing\\Router","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php","line":174,"function":"dispatch","class":"Illuminate\\Routing\\Router","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":30,"function":"Illuminate\\Foundation\\Http\\{closure}","class":"Illuminate\\Foundation\\Http\\Kernel","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/fideloper\/proxy\/src\/TrustProxies.php","line":56,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Fideloper\\Proxy\\TrustProxies","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/TransformsRequest.php","line":30,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/TransformsRequest.php","line":30,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/ValidatePostSize.php","line":27,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Middleware\/CheckForMaintenanceMode.php","line":46,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":148,"function":"handle","class":"Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}},{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Routing\/Pipeline.php","line":53,"function":"Illuminate\\Pipeline\\{closure}","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Pipeline\/Pipeline.php","line":102,"function":"Illuminate\\Routing\\{closure}","class":"Illuminate\\Routing\\Pipeline","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php","line":149,"function":"then","class":"Illuminate\\Pipeline\\Pipeline","type":"->","args":[{}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/Http\/Kernel.php","line":116,"function":"sendRequestThroughRouter","class":"Illuminate\\Foundation\\Http\\Kernel","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/Code\/valet\/astro\/public\/index.php","line":53,"function":"handle","class":"Illuminate\\Foundation\\Http\\Kernel","type":"->","args":[{"attributes":{},"request":{},"query":{},"server":{},"files":{},"cookies":{},"headers":{}}]},{"file":"\/Users\/christiancable\/.composer\/vendor\/laravel\/valet\/server.php","line":133,"args":["\/Users\/christiancable\/Code\/valet\/astro\/public\/index.php"],"function":"require"}]}]}