{"record":{"id":"cbe79c5be5578b80","repo":"slint-ui/slint","slug":"removerow-is-not-implemented-on-this-model","errorCode":null,"errorMessage":"removeRow is not implemented on this model","messagePattern":"removeRow is not implemented on this model","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"api/node/typescript/models.ts","lineNumber":154,"sourceCode":"\n    /**\n     * Adds a line to the model with the provided data.\n     * Throws when the model rejects the modification.\n     * The default implementation calls {@link Model.insertRow} with the row count.\n     * @param data new data item to store in a new row.\n     */\n    pushRow(data: T): void {\n        this.insertRow(this.rowCount(), data);\n    }\n\n    /**\n     * Implementations of this function must remove the row at the specified index.\n     * Throws when the model rejects the modification; the default implementation\n     * always throws.\n     * @param _index index of the row to remove.\n     */\n    removeRow(_index: number): void {\n        throw new TypeError(\"removeRow is not implemented on this model\");\n    }\n\n    /**\n     * Implementations of this function must add a row at the specified index, pushing all next\n     * rows to the right.\n     * Throws when the model rejects the modification; the default implementation\n     * always throws.\n     * @param _index index of the row to insert.\n     * @param _data new data item to store in a new row.\n     */\n    insertRow(_index: number, _data: T): void {\n        throw new TypeError(\"insertRow is not implemented on this model\");\n    }\n\n    [Symbol.iterator](): Iterator<T> {\n        return new ModelIterator(this);\n    }\n","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/slint-ui/slint/blob/bb937076de3f7919766c1f25e2e969367cf77e9a/api/node/typescript/models.ts#L136-L172","documentation":"BaseModel.removeRow is an abstract extension point: the base class provides no removal behavior and deliberately throws a TypeError whenever a model subclass has not overridden removeRow. It fires when application code calls removeRow (directly or via helpers) on a custom Model that only implemented the read-only parts of the interface. It is not a runtime data error — it is the default implementation's sentinel telling the developer their model class must supply the mutation.","triggerScenarios":"Calling removeRow(index) on a Model subclass that does not override removeRow, or .slint code invoking model.remove-row on such a model.","commonSituations":"Implementing a minimal read-only Model and later wiring UI delete buttons to it; forgetting the override when the model became editable.","solutions":["Override removeRow(index) in the subclass, call rowRemoved(index) after mutating backing storage.","Use ReadOnlyModel or ArrayModel which implement removeRow.","Keep the model read-only and remove delete actions from the UI."],"exampleFix":"// before\nclass M extends slint.Model { rowCount() { return this.items.length; } }\n// after\nclass M extends slint.Model {\n  removeRow(index) { this.items.splice(index, 1); this.rowRemoved(index); }\n}","handlingStrategy":"try-catch","validationCode":"if (model.removeRow === slint.Model.prototype.removeRow) throw new Error('model cannot remove rows');","typeGuard":"function supportsRemoveRow<T>(m: slint.Model<T>): boolean {\n  return m.removeRow !== slint.Model.prototype.removeRow;\n}","tryCatchPattern":"try {\n  model.removeRow(index);\n} catch (e) {\n  if (e instanceof TypeError && /removeRow is not implemented/.test(e.message)) {\n    console.warn('row removal unsupported by this model');\n  } else throw e;\n}","preventionTips":["Implement removeRow (plus rowRemoved notification) in any deletable model.","Disable delete UI for models that do not support removal.","Use ArrayModel when structural mutation is needed."],"tags":["typescript","model","not-implemented"],"backgroundTag":"method-not-implemented","analyzedSha":"bb937076de3f7919766c1f25e2e969367cf77e9a","analyzedAt":"2026-09-16T01:37:20.251Z","contentChangedAt":"2026-09-16T01:37:20.251Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}