Skip to content

fix: Load control & dialog assets with cart.js - #29625

Merged
marination merged 3 commits into
developfrom
fix-web-portal
Feb 3, 2022
Merged

fix: Load control & dialog assets with cart.js#29625
marination merged 3 commits into
developfrom
fix-web-portal

Conversation

@surajshetty3416

@surajshetty3416 surajshetty3416 commented Feb 3, 2022

Copy link
Copy Markdown
Member

Previously, control & dialog assets were getting loaded only on visiting "/cart", but since cart.js sets up various events on the homepage, dialog-related assets are required up-front.

fixes frappe/frappe#15869
image


The issue was introduced via #27923


Final Fix:

Issue:

  • cart.js was added to the erpnext-web bundle, so it loaded on every single page
  • It requires controls bundle from frappe to make dialogs in it's file, which it relies on cart.html for
  • Since only js was loaded on login, the lack of controls bundle broke the js asset > and thus the login page wouldn't work (static page)
  • This file shouldn't have been in the bundle since it is specific to cart.html, not a generic utility file unlike the others.

Fix:

  • Move cart.js to /templates/pages with cart.html. They are tightly bound and exclusive to eachother
  • Remove cart.js import from bundle

Previously, control & dialog assets were getting loaded only on visiting "/cart", but since cart.js sets up various events on homepage, dialog related assets are required up-front.
@marination

marination commented Feb 3, 2022

Copy link
Copy Markdown
Contributor

@surajshetty3416 I think cart.js should not be in the bundle, I must have absent mindedly put that in. Its js for cart.html. Not generic enough to be in the bundle.
Relocating the file and removing the import in the bundle would solve this issue.
It should not impact the login page 🥲
I'll relocate it and test if it breaks anything

- Due to it being in the bundle, controls bundle was required for Dialogs used in cart
- But this is exclusively used in `cart.html`
- It has no reason to load and break the login page
- Moved it back to where the html is, it is now back to being tightly coupled with its html
@marination

Copy link
Copy Markdown
Contributor

Login works:
2022-02-03 21 44 37

Cart works too:
2022-02-03 21 45 44

Can confirm for other pages too (Source: trust me)

@marination
marination marked this pull request as ready for review February 3, 2022 16:24
@marination
marination removed the request for review from nextchamp-saqib February 3, 2022 16:25
@marination
marination merged commit 4d5749b into develop Feb 3, 2022
@marination

Copy link
Copy Markdown
Contributor

@Mergifyio backport version-14-beta-pre-release

@mergify

mergify Bot commented Feb 3, 2022

Copy link
Copy Markdown
Contributor

backport version-14-beta-pre-release

✅ Backports have been created

Details

marination added a commit that referenced this pull request Feb 3, 2022
…release/pr-29625

fix: Load control & dialog assets with `cart.js` (backport #29625)
@surajshetty3416
surajshetty3416 deleted the fix-web-portal branch February 3, 2022 17:11
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jan 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unable to Login

2 participants