Skip to content

fix: makeWidget breakpoint layout issue #3071 #3072

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

FilipKujavec
Copy link

Description

See #3071 for description of issue. I added setting _loading to true in _prepareElement to fix the order issue and changed how we check if node._id is present (previously it would be false when called with the first element as it has an id of 0, not sure if this was wanted)

Checklist

  • [- ] Created tests which fail without the change (if possible)
  • [X ] All tests passing (yarn test)
  • [- ] Extended the README / documentation, if necessary

@@ -417,14 +417,14 @@ export class GridStackEngine {
// remember it's position & width so we can restore back (1 -> 12 column) #1655 #1985
// IFF we're not in the middle of column resizing!
const saveOrig = (node.x || 0) + (node.w || 1) > this.column;
if (saveOrig && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && node._id && this.findCacheLayout(node, this.defaultColumn) === -1) {
if (saveOrig && this.column < this.defaultColumn && !this._inColumnResize && !this.skipCacheUpdate && !isNaN(node._id) && this.findCacheLayout(node, this.defaultColumn) === -1) {
Copy link
Member

Choose a reason for hiding this comment

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

good catch!
node._id!==undefined or node._id?? might be less specific

Copy link
Author

Choose a reason for hiding this comment

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

Screenshot 2025-06-12 072132
node._id is currently defined as a number, but I can change it to node._id?? to be more generic if wanted

Copy link
Member

Choose a reason for hiding this comment

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

yes please.

src/gridstack.ts Outdated
@@ -1633,7 +1633,9 @@ export class GridStack {
el.gridstackNode = node;
node.el = el;
node.grid = this;
this.engine._loading = true; // help with collision
Copy link
Member

Choose a reason for hiding this comment

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

this feels wrong and would have to debug it myself. too low level and could conflict with other proper calls

Copy link
Author

Choose a reason for hiding this comment

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

removed it for now

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