Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Rebuild state from props when changing from one property edit page to another #2703

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

evantahler
Copy link
Member

@evantahler evantahler commented Dec 21, 2021

Fixes a bug when using the new Property Preview widget when switching from one property page to another. We store the initial page props in local state variables (so they can be edited by the user), and we need to reset those with the new props.

Checklists

Development

  • Application changes have been tested appropriately

Impact

  • Code follows company security practices and guidelines
  • Security impact of change has been considered
  • Performance impact of change has been considered
  • Possible migration needs considered (model migrations, config migrations, etc.)

Please explain any security, performance, migration, or other impacts if relevant:

Code review

  • Pull request has a descriptive title and context useful to a reviewer. Screenshots or screencasts are attached where applicable.
  • Relevant tags have been added to the PR (bug, enhancement, internal, etc.)

@evantahler evantahler added the bug Something isn't working label Dec 21, 2021

useEffect(() => {
updatePluginOptions();

return () => {
clearTimeout(timer);
};
}, [JSON.stringify(property.options)]);
}, [property.id, JSON.stringify(property.options)]);
Copy link
Contributor

@edmundito edmundito Dec 21, 2021

Choose a reason for hiding this comment

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

What's the difference between propertyId above and property.id?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this hook wants to be called after property is set, which the previous hook will do after the URL (propertyID) changes

@evantahler evantahler merged commit b1d6441 into main Dec 21, 2021
@evantahler evantahler deleted the 180254221-fix-destination-links branch December 21, 2021 17:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants