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

Mark get* functions as deprecated #553

Open
JohnAlbin opened this issue Oct 17, 2023 · 0 comments
Open

Mark get* functions as deprecated #553

JohnAlbin opened this issue Oct 17, 2023 · 0 comments
Assignees
Labels
area: next-drupal enhancement New feature or request

Comments

@JohnAlbin
Copy link
Collaborator

JohnAlbin commented Oct 17, 2023

Package

next-drupal (NPM package)

Describe the feature request

The preferred usage since Next-Drupal 1.6 is to use the DrupalClient class.

The get* functions (like getRousource()) recommend in the 1.0 release are informally deprecated. (Though the use-menu hook still uses one of them internally.)

It makes sense to deprecate those functions since they require environment variables like NEXT_PUBLIC_DRUPAL_BASE_URL to configure the JSON:API endpoint. And that setup is inflexible as it's impossible to query two or more Drupal endpoints in one codebase.

Describe the solution you'd like

The get* functions should be formally deprecated. Any use of them should generate a console warning about a deprecated usage. And we should add a JSDoc comment with a @deprecated flag.

That suggestion comes from a StackOverflow question about marking obsolete methods.

It's unclear if deprecating useMenu() should also be done, but it does use a getMenu() internally.

Describe alternatives you've considered

Just removing them in 2.x, but a little more warning would be nice.

@JohnAlbin JohnAlbin added enhancement New feature or request area: next-drupal labels Oct 17, 2023
@JohnAlbin JohnAlbin self-assigned this Oct 17, 2023
@JohnAlbin JohnAlbin modified the milestone: next 1.3.0 Oct 17, 2023
@JohnAlbin JohnAlbin changed the title Mark get-* functions as deprecated Mark get* functions as deprecated Oct 19, 2023
@JohnAlbin JohnAlbin added this to the next-drupal 2.x milestone Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: next-drupal enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant