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

Add _componentFileName to component request payload #41

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

Conversation

agarzola
Copy link

@agarzola agarzola commented Sep 15, 2023

Description

This PR updates the fetchStoryHtml.ts to add the _componentFileName request parameter in addition to (not a replacement of) _storyFileName in accordance with merge request 19 in cl_server, which deprecates _storyFileName in favor of _componentFileName.

Motivation

See Drupal issue 3387642.

@e0ipso
Copy link
Member

e0ipso commented Sep 18, 2023

I am hesitant about this change. This will make this addon incompatible with some versions of CL server. This would lead us to major version changes for both projects, which seems like a lot of hassle for changing the name of a private parameter.

Perhaps we can save this for when we are ready for a new major version. What do you think?

@agarzola
Copy link
Author

@e0ipso That makes sense to me. Another alternative would be to pass both _storyFileName and _componentFileName, with a to-do to remove _storyFileName in the next major version. Would that make this PR more palatable in the short term?

Copy link
Author

@agarzola agarzola left a comment

Choose a reason for hiding this comment

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

@e0ipso I pushed a commit that should help make this PR a lot more palatable in the short term. Let me know your thoughts!

Comment on lines +48 to 56
_componentFileName: string;
// Preserve backward compatibility with older versions of drupal/cl_server:
_storyFileName: string;
_drupalTheme: string;
_variant?: string;
_params: string;
} = {
_componentFileName: context.parameters.fileName,
_storyFileName: context.parameters.fileName,
Copy link
Author

Choose a reason for hiding this comment

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

I updated this PR to include both parameters, which preserves backward compatibility. See accompanying commit for cl_server, which deprecates (instead of dropping) _storyFileName.

This should make for a smoother transition.

@e0ipso
Copy link
Member

e0ipso commented Sep 26, 2023

I am still resistant of this change. This adds a certain level of risk (someone updates this plugin, but not the Drupal module), and I see no real benefit of renaming internal variable names and methods.

I agree that your proposed names make more sense, but this is not something that justifies the maintenance burden that supporting a matrix of compatibility versions carries.

Perhaps when we have plans to do a major update for other reasons, this should make it in?

Let me know if I am missing something. Have you started working on a different pattern library implementation?

@agarzola agarzola changed the title Rename _storyFileName to _componentFileName Add _componentFileName to component request payload Sep 26, 2023
@agarzola
Copy link
Author

@e0ipso Thanks for reviewing. This PR sends both parameters (_componentFileName and _storyFileName) precisely to avoid the burden you mention. However, I just realized that I had failed to update the PR title and description, so I just updated both to more accurately represent this change set.

Can you take another look and let me know of any additional maintenance considerations that I may be missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants