Skip to content
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

fix: save table column order on setAll #200

Merged
merged 4 commits into from
Jun 29, 2023

Conversation

joelamb
Copy link
Contributor

@joelamb joelamb commented Jun 20, 2023

enable re-ordered columns to be saved to preferences

@changeset-bot
Copy link

changeset-bot bot commented Jun 20, 2023

🦋 Changeset detected

Latest commit: ced9ca3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
ember-headless-table Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Jun 20, 2023

@@ -0,0 +1,8 @@
---
"ember-headless-table": patch
"test-app": patch
Copy link
Contributor

Choose a reason for hiding this comment

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

test-app needs to be private 🙃

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated changeset

@nicolechung
Copy link
Contributor

nicolechung commented Jun 22, 2023

Suggestion: It would be helpful if we showed how this works with preferences in the docs:

The description of how to use it with preferences exists, but could stand to have a bit more detail (a demo or a code snippet of how to set it up)
Screenshot 2023-06-22 at 12 22 49 PM

}
}
},
"ColumnVisibility": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Question: why is ColumnVisibility here? Was that set up from a previous test?

Copy link
Contributor Author

@joelamb joelamb Jun 23, 2023

Choose a reason for hiding this comment

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

It's because the tests in this module are set up with the Column Visibility plugin on line 376, and including that module adds the property to the preferences object

@joelamb
Copy link
Contributor Author

joelamb commented Jun 23, 2023

@nicolechung Code snippet added to documentation for Column Reordering. There is no setup required - the preferences object is automatically created when the plugin is included. It's up to the consuming app to handle where and how to save the provided object.

Copy link
Contributor

@ynotdraw ynotdraw left a comment

Choose a reason for hiding this comment

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

Change looks good to me! To get a release you'll still want to do pnpm changeset and select ember-headless-table as the package to bump!

Comment on lines +508 to +506
// @ts-expect-error
setColumnOrder(ctx.table, order);
Copy link
Contributor

@ynotdraw ynotdraw Jun 26, 2023

Choose a reason for hiding this comment

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

Not being in this repo much:

Out of curiosity - why is this @ts-expect-error required? Are we not supposed to be calling this directly? Adding a comment here for future travelers may be helpful.

Copy link
Contributor Author

@joelamb joelamb Jun 27, 2023

Choose a reason for hiding this comment

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

Without it I get a TS error

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setColumnOrder is not usually called directly (it's in the helpers.ts) so we're OK to ignore the TS error here.

@@ -5,7 +5,7 @@ runs:
steps:
- uses: pnpm/[email protected]
with:
version: 7
version: 7.32.5
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious, why this update?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see #199

It's to address an issue around pnpm lock files

@nicolechung
Copy link
Contributor

Code snippet added to documentation for Column Reordering. There is no setup required - the preferences object is automatically created when the plugin is included. It's up to the consuming app to handle where and how to save the provided object

I didn't fully read this the first time (osrry, Monday morning) and left a suggestion and then re-read your comment and deleted it. Pretty neat that the preferences object is automatically created!

Base automatically changed from add-engines-field-to-package-json to main June 27, 2023 14:54
enable re-ordered columns to be saved to preferences
@joelamb joelamb merged commit 9af0da9 into main Jun 29, 2023
25 checks passed
@joelamb joelamb deleted the persist-reordered-cols-in-user-prefs branch June 29, 2023 09:01
@github-actions github-actions bot mentioned this pull request Jun 29, 2023
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.

4 participants