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

Demo info not rendering #234 #238

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

MingyiXu11
Copy link
Contributor

@ddfridley ddfridley linked an issue Nov 4, 2024 that may be closed by this pull request
Copy link
Contributor

@ddfridley ddfridley left a comment

Choose a reason for hiding this comment

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

See the comments in-line, and please remember to remove console.logs when final.
Invalid date format should be an error not a warn.
Thanks!

@@ -8,7 +8,7 @@ export default {

export const PrimaryAllFieldsIncluded = {
args: {
dob: '1990-10-20T00:00:00.000Z',
dob: '1990-10-20',
Copy link
Contributor

Choose a reason for hiding this comment

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

The test data is correct, it's an ISO format date string. If necessary please fix the code to work with the data in the story.

Copy link
Contributor

@ddfridley ddfridley left a comment

Choose a reason for hiding this comment

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

Something is weird in this PR. There are lines missing, but they aren't showing up in the diff from master. Also the export it missing, but not showing up in the diff.

Can you 'git fetch' and 'git merge origin/master' and resolve the conflicts, and make sure it looks right.

Did you at any time do a rebase? If so, let me know and lets figure out what to do.

@@ -5,10 +5,12 @@ import insertSheet from 'react-jss'

function DemInfo(props) {
const { state, dob, party, classes, className, ...otherProps } = props
Copy link
Contributor

Choose a reason for hiding this comment

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

classes is not a prop, it is create by:

  const classes = useStylesFromThemeFunction()

@MingyiXu11
Copy link
Contributor Author

Hello David,
I've completed a 'git fetch' and 'git merge'. I didn't do a rebase.
Thanks!

Copy link
Contributor

@ddfridley ddfridley left a comment

Choose a reason for hiding this comment

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

The merge and new push fixed the problems I was seeing, I don't understand why it happened though.

I see that the change to using new Date(...).toString() didn't really fix the behavior of storybook.

I even copied an iso date string into the party field and got the same soft of behavior - it doesn't show the text anymore, it just says edit. But you can put in new stuff and it works.

Since the change didn't really effect anything, and we go back to just using the strings. as before. I worry that future me, or some new looking at this will think that something has to be done to the data coming out of the db.

@MingyiXu11
Copy link
Contributor Author

Hello David,

If I use dob: new Date('1990-10-20T00:00:00.000Z') to replace dob: new Date('1990-10-20T00:00:00.000Z').toISOString(), the behavior in Storybook will be fixed (see Figure 1). Could we proceed with this approach?

Also, there are a couple of issues in the demo-info code in the master branch.

The line const { state, dob, party, classes, className, ...otherProps } = props; incorrectly creates the class variable.
The condition if (!(state && dob && party)) return null; causes an empty page to render (see Figure 2).
I've submitted a new PR to address these issues.

截屏2024-11-16 00 52 25

截屏2024-11-16 00 46 18

Copy link
Contributor

@ddfridley ddfridley left a comment

Choose a reason for hiding this comment

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

for dem-info.stories.jsx what I'm asking for is essentially to revert the file back to what it was originally. Where dob is assigned a string. '1990-10-20T00:00:00.000Z', I wasn't asking to take of the .toString() I was asking to get ride for the whole new Date( part. The story needs to emulate what the parent component is going to pass to the component in the integrated application.

the comment about classes in props in master was part of the weird behavior. It's not like that in origin/master. Perhaps some changes got unintentionally committed to the local copy of master on your machine. But the PR online looks fine at this poiint: https://github.com/EnCiv/civil-pursuit/pull/238/files

That this case http://localhost:6006/?path=/story/dem-info--party-only-empty-field returns null is correct. There is nothing to render.

@MingyiXu11
Copy link
Contributor Author

Hello David,

Thank you for the clarification. I'm a bit unclear about the next steps. Should I make further changes to the PR, or just proceed with https://github.com/EnCiv/civil-pursuit/pull/238/files?

Thanks!

@ddfridley
Copy link
Contributor

That is the PR. If you push changes to your branch they will show up there. See #238.

Copy link
Contributor

@ddfridley ddfridley left a comment

Choose a reason for hiding this comment

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

Please look at the PR, https://github.com/EnCiv/civil-pursuit/pull/238/files - there are no real changes any more.

I was trying to get you to revert the changes to the story file, but not to the component.

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.

Demo Info not rendering
2 participants