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

Rename storyByModuleExport to resolveModuleExport #20517

Merged
merged 12 commits into from
Jan 10, 2023

Conversation

tmeasday
Copy link
Member

@tmeasday tmeasday commented Jan 6, 2023

So it can return either, allowing generic uses of of={}

Issue:

What I did

Renamed the call, updated usages.

How to test

  • I think we should add unit tests for docsContext. We should potentially wait to merge this.
  • Basic usages should be tested by e2e tests I think.
  • We don't currently automatically test external docs so we should check that still works.

@tmeasday tmeasday added maintenance User-facing maintenance tasks addon: docs labels Jan 6, 2023
@tmeasday tmeasday requested a review from JReinhold January 6, 2023 12:38
@JReinhold
Copy link
Contributor

This looks like a good first step. But componentOrStoryIdByModuleExport returns the ID, how would one go from that ID to the actual meta? For stories we have the storyById.

I think we want a helper like componentOrStoryIdByModuleExport, that returns the actual story/meta. At least for blocks, the ID is rather worthless and you almost always just take that ID and pass it to storyById, so it'd be nice to have that function directly.

On another note, I'm still confused as to when we use the meta term and when we call it component, but I guess you have that under control here.

@tmeasday tmeasday changed the title Rename to componentOrStoryIdByModuleExport Rename storyByModuleExport to resolveModuleExport Jan 7, 2023
@tmeasday tmeasday force-pushed the add-componentOrStoryIdByModuleExport branch from 6fb9a4c to f91a6b1 Compare January 7, 2023 05:22
@JReinhold
Copy link
Contributor

JReinhold commented Jan 9, 2023

After trying this out in the Description block, I'm seeing something unexpected that we should discuss.

the csfFile.meta returned when type is meta, is the "original, raw" Meta, and doesn't inherit anything from the project annotations. I guess I should have seen this coming, I don't know why I thought it would work. This means that parameters and others are vastly different between the returned meta and the primary story.

For Description, that makes the returned meta unusable, as it reads parameters.docs.extractComponentDescription as defined globally by renderers.
A workaround would be to read the primary story, but that wouldn't work in unattached mode.

@tmeasday tmeasday merged commit b0eca3f into next Jan 10, 2023
@tmeasday tmeasday deleted the add-componentOrStoryIdByModuleExport branch January 10, 2023 06:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: docs maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants