-
Notifications
You must be signed in to change notification settings - Fork 32
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
[FIX] figure,chart: Enforce unicity of figure ids #2157
Conversation
69422fd
to
acf96cf
Compare
@@ -239,7 +242,7 @@ export class ChartPanel extends Component<Props, SpreadsheetEnv> { | |||
private updateChart(definition: ChartUIDefinitionUpdate): DispatchResult { | |||
return this.env.dispatch("UPDATE_CHART", { | |||
id: this.props.figure.id, | |||
sheetId: this.getters.getActiveSheetId(), | |||
sheetId: this.state.chartSheetId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sheetId in this command is still unused, right ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not here ,but it's actually used starting v16.0
this.state.chart = this.env.getters.getChartDefinitionUI( | ||
this.env.getters.getActiveSheetId(), | ||
this.state.chartSheetId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is it in the state ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no good reason , no need for reactivity as it changes with the figure - you're right
src/migrations/data.ts
Outdated
@@ -343,6 +385,55 @@ function dropCommands(initialMessages, commandType: string) { | |||
return messages; | |||
} | |||
|
|||
function fixUpdateChart(data: Partial<WorkbookData>, initialMessages: StateUpdateMessage[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't understand why it's needed since cmd.sheetId
is unused anyway
(and should be eventually removed)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, used in 16.0+ atm
a1a1d02
to
dc9c259
Compare
The issue of duplicated chart ids was first addressed in PR #2102 by trying to defined chart ids per sheet (just like figures) Unfortunately, the fix was not appropriate for several reasons: 1. Some commands in Odoo were not dispatching the sheetId along with the chartId, making the mapping sheetId, chartId hazardous 2. There was absolutely 0 verification that the commands targeting a chartId were also providing a sheet Id that matched. So the said commands cannot be trusted either This commit is exploring the other solution that is forcing the unicity of a figure id. The data are adapted so that figures with a duplicated id well have the latter updated to ensure unicity. This commit also tries to solve the wrong `sheetId` parameter in `UPDATE_CHART` by simply ignoring it in the commands. It's not necesarry since we now have the unicity of figure ids.
dc9c259
to
0227135
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
robodoo r+
The issue of duplicated chart ids was first addressed in PR #2102 by trying to defined chart ids per sheet (just like figures) Unfortunately, the fix was not appropriate for several reasons: 1. Some commands in Odoo were not dispatching the sheetId along with the chartId, making the mapping sheetId, chartId hazardous 2. There was absolutely 0 verification that the commands targeting a chartId were also providing a sheet Id that matched. So the said commands cannot be trusted either This commit is exploring the other solution that is forcing the unicity of a figure id. The data are adapted so that figures with a duplicated id well have the latter updated to ensure unicity. This commit also tries to solve the wrong `sheetId` parameter in `UPDATE_CHART` by simply ignoring it in the commands. It's not necesarry since we now have the unicity of figure ids. closes #2157 Signed-off-by: Pierre Rousseau (pro) <pro@odoo.com>
Description:
The issue of duplicated chart ids was first addressed in PR #2102 by
trying to defined chart ids per sheet (just like figures)
Unfortunately, the fix was not appropriate for several reasons:
chartId, making the mapping sheetId, chartId hazardous
chartId were also providing a sheet Id that matched. So the said
commands cannot be trusted either
This commit is exploring the other solution that is forcing the unicity
of a figure id. The data are adapted so that figures with a duplicated
id well have the latter updated to ensure unicity.
This commit also tries to solve the wrong
sheetId
parameter inUPDATE_CHART
by simply ignoring it in the commands. It's not necesarrysince we now have the unicity of figure ids.
15.0-fix-charts-rar (#2157)
description of this task, what is implemented and why it is implemented that way.
Odoo task ID : TASK_ID
review checklist