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

Bugfix/autofill variable bug #792

Merged
merged 13 commits into from
Jan 13, 2025
Merged

Conversation

lagartoverde
Copy link
Contributor

Overview

The autofill variable bug described in GN-5210 was caused by the agendapoints.edit controller setting the plugins before the route was loaded and the current session object was filled. I reworked that interaction so nothing is called until everything has loaded correctly

connected issues and PRs:

GN-5210

Setup

None

How to test/reproduce

You can try reproducing the bug, basically if you create an IV, go to the first agendapoint and in the besluit snippet list you selected one of the options with the autofill variable the first time it should work, but if you refresh and do the same again it didn't work.
Now it always work, as the autofill plugin is not set up until everything has been loaded

Challenges/uncertainties

Not enough knowledge of the headless editor so I think I did everything correctly so that also works, but please Elena verify :)

Checks PR readiness

  • UI: works on smaller screen sizes
  • UI: feedback for any loading/error states
  • Check cancel/go-back flows
  • Check database state correct when deleting/updating (especially regarding relationships)
  • changelog
  • npm lint
  • no new deprecations

@lagartoverde lagartoverde added the bug Something isn't working label Dec 6, 2024
@lagartoverde lagartoverde self-assigned this Dec 6, 2024
@elpoelma
Copy link
Contributor

elpoelma commented Dec 6, 2024

Just a small comment already, will do a full review after: putting the creation of a prosemirror schema in a dynamic getter can cause issues. I'll try to dig up the original PR where the change was introduced to move away from dynamic getters for schemas.

Edit, found it: https://binnenland.atlassian.net/browse/GN-4206

You can reproduce the issue when trying to paste a link.
If you do want to use a dynamic getter here, I think a cached getter might help you out.

@abeforgit
Copy link
Member

gonna also leave this one out of todays hotfix, not so urgent and would be good to test

Copy link
Contributor

@elpoelma elpoelma left a comment

Choose a reason for hiding this comment

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

Looks good overall and solves the issue. I do have some comments though.

app/controllers/agendapoints/edit.js Show resolved Hide resolved
app/controllers/agendapoints/edit.js Outdated Show resolved Hide resolved
Comment on lines 51 to 52
get citationPlugin() {
return this.agendapointEditor.citationPlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe it's better to also move this to the getSchemaAndPlugins hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This needs to be like this because the card makes reference to the plugin

Copy link
Contributor

@elpoelma elpoelma Dec 13, 2024

Choose a reason for hiding this comment

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

Yes I understand why it's needed, but making it a dynamic getter will break the autocomplete of the citation-plugin.
As the citationPlugin you pass to the card is not the same one you pass to prosemirror.

app/templates/agendapoints/edit.hbs Outdated Show resolved Hide resolved
const { schema, plugins } =
this.agendapointEditor.getSchemaAndPlugins(false);
this.schema = schema;
const citationPlugin = this.agendapointEditor.citationPlugin;
Copy link
Member

Choose a reason for hiding this comment

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

so now this means that anywhere we use this service, we just have to remember to treat the citationPlugin property in this special way?
this doesn't seem like a good solution...
something is off here, we're making a fundamentally simple thing complicated
ember is not being very helpful in all this, but I do have some ideas, I'll have a look

@elpoelma elpoelma force-pushed the bugfix/autofill-variable-bug branch from 48cc4cf to efed22f Compare January 2, 2025 15:33
@elpoelma elpoelma changed the base branch from master to internal/update-editor-packages January 2, 2025 15:33
@elpoelma elpoelma changed the base branch from internal/update-editor-packages to master January 9, 2025 08:42
@elpoelma elpoelma force-pushed the bugfix/autofill-variable-bug branch from efed22f to 27e2ebc Compare January 9, 2025 08:45
@elpoelma elpoelma force-pushed the bugfix/autofill-variable-bug branch from 27e2ebc to 5294b67 Compare January 9, 2025 08:46
Copy link
Contributor

@elpoelma elpoelma left a comment

Choose a reason for hiding this comment

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

Looks good now!

  • Citation plugin triggers as expected
  • The autovar functionality works across reloads

@lagartoverde lagartoverde merged commit e1c57b0 into master Jan 13, 2025
3 checks passed
@lagartoverde lagartoverde deleted the bugfix/autofill-variable-bug branch January 13, 2025 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants