frappe / gameplan

Delightful, open-source, work communication tool for remote teams
GNU Affero General Public License v3.0
277 stars 111 forks source link

Can't delete page #298

Open blaggacao opened 2 months ago

blaggacao commented 2 months ago

image

huembw commented 1 month ago

hi @blaggacao The button works properly. It deletes the page. The problem is that the modal is expected to close after deleting successfully

blaggacao commented 1 month ago

It's been a while, but I don't remember ever see a page disappear (except if I delete it from the backend).

blaggacao commented 1 month ago

It appears this requires websocket via ws and does not work (well/at all) with long polling.

blaggacao commented 1 month ago

@netchampfaris I noticed that I can locally reproduce after running bench build --apps gameplan. Without a build it works well, but after the production build it's broken.

blaggacao commented 1 month ago
runtime-core.esm-bundler.js:262 TypeError: u is not a function
    at Proxy.onClick (PageGrid.vue:13:12)
    at onClick (Dialog.vue:206:34)
    at runtime-dom.esm-bundler.js:711:60
    at Ir (runtime-core.esm-bundler.js:195:19)
    at gn (runtime-core.esm-bundler.js:202:17)
    at gn (runtime-core.esm-bundler.js:212:17)
    at HTMLButtonElement.n (runtime-dom.esm-bundler.js:693:5)
blaggacao commented 1 month ago

Fixed by:

diff --git a/frontend/src/pages/PageGrid.vue b/frontend/src/pages/PageGrid.vue
index 33ce698..fdc58df 100644
--- a/frontend/src/pages/PageGrid.vue
+++ b/frontend/src/pages/PageGrid.vue
@@ -22,9 +22,9 @@
                   actions: [
                     {
                       label: 'Delete',
-                      onClick: ({ close }) => {
+                      async onClick(close) {
+                        await $resources.pages.delete.submit(d.name)
                         close()
-                        return $resources.pages.delete.submit(d.name)
                       },
                       variant: 'solid',
                       theme: 'red',

(inspired by how its done in frappe/crm)