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

New entries with a Date field show changed status #725

Open
tech4him1 opened this issue Oct 23, 2017 · 11 comments
Open

New entries with a Date field show changed status #725

tech4him1 opened this issue Oct 23, 2017 · 11 comments

Comments

@tech4him1
Copy link
Contributor

tech4him1 commented Oct 23, 2017

- Do you want to request a feature or report a bug?
bug

- What is the current behavior?
Entries with a Date field will ask the user whether or not they want to save changes, when the entry was just created.

- If the current behavior is a bug, please provide the steps to reproduce.

  1. Create a new entry (with a Date field).
  2. Try to leave it (click the home button).

- What is the expected behavior?
If nothing has been added, the entry should not prompt to save.

- Please mention your CMS, node.js, and operating system version.

0.5.1 (actually master)

@tech4him1 tech4him1 self-assigned this Oct 23, 2017
@tech4him1 tech4him1 changed the title *Some kinds* of new entries prompt to save changes when created New entries with a Date field show changed status Oct 23, 2017
@tech4him1 tech4him1 removed their assignment Oct 26, 2017
@tech4him1 tech4him1 modified the milestone: 1.0.0 Oct 26, 2017
@tech4him1
Copy link
Contributor Author

This happens with the Relation Widget also, even on existing entries. It is due to the way widgets dynamically set their inital state -- widgets that do not set inital state (most) do not cause this bug.

@tech4him1 tech4him1 added this to the 1.0.0 milestone Nov 17, 2017
@tech4him1 tech4him1 changed the title New entries with a Date field show changed status New entries with a Date or Relation field show changed status Nov 28, 2017
@tech4him1
Copy link
Contributor Author

The way I see to fix that would be to provide a "default default", maybe static default = new Date() on the widget, that the widget registry checks for if no default is set.

@erquhart
Copy link
Contributor

We could also provide a setDefault function via props, would be a bit cleaner that way.

@ianworth
Copy link

ianworth commented Jun 12, 2019

As per PR just created - we've encountered a similar issue to that reported here where the inclusion of a relation widget in the editor page causes an article to require hitting the save button twice to save the article. This seems to be because the setting of metadata in the a DRAFT_CHANGE_FIELD signal is changing hasChanged attribute in the entry state to be true even though the value has not changed at all.

I'm new to the internals of Netlify CMS and various logic flows, but I'm wondering whether the metadata changing should really be indicating that entry has changed, or whether this meta data is just used for the CMS interface. Any guidance on any side effects not setting hasChange to true when only meta data set would be appreciated to help me steer to the correct solution.

@ianhomer
Copy link

Just updated the PR above so now preview - https://deploy-preview-2377--cms-demo.netlify.com/ - allows you to create new post / edit post / new kitchen sink / edit kitchen sink, with the hasChanged flag not being set on load of the first screen (i.e. no changes to save wrongly detected) , and that flag is only changed with you actually make some content changes.

@erquhart
Copy link
Contributor

Awesome, I'll take a look soon!

@homearanya
Copy link
Contributor

Any updates on this?

@erquhart
Copy link
Contributor

erquhart commented Sep 5, 2019

The right approach is going to involve widgets setting their own default values and directly reporting clean/dirty status, which means some API additions - this requires communication and agreement about approach before a PR is opened.

@stale
Copy link

stale bot commented Nov 4, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the status: stale label Nov 4, 2019
@stale stale bot removed the status: stale label Nov 4, 2019
@bobbymart1n
Copy link

Just curious, is there a workaround until this PR gets merged?

@barthc barthc changed the title New entries with a Date or Relation field show changed status New entries with a Date field show changed status Feb 28, 2020
@barthc
Copy link
Contributor

barthc commented Feb 28, 2020

The relation field status change already fixed here #3306, we are now only dealing with the date widget.

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

No branches or pull requests

8 participants