Skip to content

Commit

Permalink
fix header: pg-render-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
luanfreitasdev committed Sep 1, 2024
1 parent 608ec7e commit cccd1d8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 1 addition & 1 deletion dist/mix-manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"/powergrid.js": "/powergrid.js?id=9420b22618424ae86b2ded1f4d726748",
"/powergrid.js": "/powergrid.js?id=05c5f62ec274e8fcf8d83856987538fe",
"/bootstrap5.css": "/bootstrap5.css?id=a27af22343149104b2aa3283d8fd502b",
"/tailwind.css": "/tailwind.css?id=924477e2afcb2cb56aa392e266ee56ca"
}
2 changes: 1 addition & 1 deletion dist/powergrid.js

Large diffs are not rendered by default.

21 changes: 13 additions & 8 deletions resources/js/components/pg-render-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ export default (params) => ({
cookieKey: null,
parentId: params?.parentId ?? null,
init() {
if (this.rowId == null) {
return;
}

this.setKeys();

window.addEventListener('beforeunload', () => {
Expand All @@ -17,13 +13,22 @@ export default (params) => ({
},

setKeys() {
this.storageKey = `pg_session_${this.$wire.tableName}_row_${this.rowId}`;
this.cookieKey = `pg_cookie_${this.$wire.tableName}_row_${this.rowId}`;
if (this.rowId) {
this.storageKey = `pg_session_${this.$wire.tableName}_row_${this.rowId}`;
this.cookieKey = `pg_cookie_${this.$wire.tableName}_row_${this.rowId}`;

return;
}

this.storageKey = `pg_session_${this.$wire.tableName}_header_actions`;
this.cookieKey = `pg_cookie_${this.$wire.tableName}_header_actions`;
},

toHtml() {
if (localStorage.getItem(this.storageKey)) {
return localStorage.getItem(this.storageKey);
const value = localStorage.getItem(this.storageKey)

if (typeof value === 'string' && value.length > 0) {
return value;
}

const actions = this.rowId
Expand Down

0 comments on commit cccd1d8

Please sign in to comment.